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/
Recursive algorithms can be slow because they end up solving the same little problems over and over again. To speed them up, you can use a technique called "memoization." Memoization allows algorithms go much more quickly by remembering solutions to problems they have already solved. I’m the recursive algorithm. This blog is my memoization.
Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts
Friday, May 22, 2015
More organized javascript
Thursday, May 14, 2015
Reintroduction to javascript
I found this really nice:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
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
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
Saturday, December 6, 2014
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 . . .
https://github.com/ndp/align-column
Now if you don't have a table . . .
Subscribe to:
Posts (Atom)