Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Friday, May 22, 2015

More organized javascript

I do a lot of writing in Python and everything seems to be nicely arranged and easy to follow and then I go to what I've written in Javascript and jQuery and it looks like a mess.  It's comparatively hard to follow even much smaller tracts of code.

So here are a couple of resources on organizing Javascript code.
 
http://alistapart.com/article/the-design-of-code-organizing-javascript
http://addyosmani.com/resources/essentialjsdesignpatterns/book/
http://rmurphey.com/blog/2009/10/15/using-objects-to-organize-your-code/

Saturday, February 14, 2015

Gorgeous vanilla javascript to make a simple Pong using only canvas

I've been thinking about getting into vanilla javascript and specifically into the canvas element.  You can read through tutorials and so on, but nothing is nicer for something like this than seeing good code.  It's even better if it's simple.

So tonight I felt extremely lucky to happen upon this:

Ben Shepherd did a screencast of himself coding up a very simple pong using Javascript canvas here (check out the music on this video too):

https://www.youtube.com/watch?v=ITmH-W49Mvk

But, even better he posted the code.  It's beautiful, with good patterns, and it's extremely easy to understand.  Wow.

Here's the code (and, since this is JS, it's a working Pong):

 http://passion4web.co.uk/ben/pong.html

Thursday, December 4, 2014

Javascript library for aligning decimal points in a table

Apparently this is a bit of a trick in html, but here's a library if you have a table with columns:

https://github.com/ndp/align-column

Now if you don't have a table . . .