Using Jquery to display your GitHub repos
Here is a quick little script to pull down your GitHub Repos and display them on a page:
Interesting note - I started off by using the append function inside the $.each loop - but after reading Josh Powell’s post on using append correctly I switched to building the HTML from a concatenated string. The result loads noticeably faster.
Check out the result on GitHub:
March 6th, 2009 at 5:03 pm
Thanks John, you made my day
One thing I learned after writing the article, and added in the first comment, was that it is much quicker to append a single node with a lot of children then it is to append a bunch of nodes. So in your example above, if you could find a way to append the complete list instead of the list items it would be measurably quicker. Possibly use replaceWith() or replaceAll() instead of append.
March 6th, 2009 at 5:19 pm
Thanks for the excellent article Josh! Check out Josh’s full reasoning here:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly/comment-page-1#comment-71018
Without knowledge of JQuery’s internal working it’s very easy to write inefficient code.
John Resig also had excellent post about profiling JS functions using FireUnit:
http://ejohn.org/blog/function-call-profiling/