jamesward/github-files — pull request #3 by kalisjoshua (2012-06-30 16:59:36+00:00)
Title: Simple Refactor

I simplified a lot of the code to be easier to read and understand (I think?).

1. Abstracting out the success function body should provide a little bit of a performance boost since it doesn't need to be defined in each call to getGithubFile.
2. I removed the .ready portion since defining the plugin doesn't depend on the DOM being loaded.
3. I left the method on the jQuery object directly since I didn't want to refactor the tests at all.
4. Everything is pretty much a one-liner now.

The success function could be further refined if you wanted to use Function.bind and there would be further performance increase - albeit not perceptible to user in most cases. I think that some functionality would be better refactored out to data-attributes in the DOM to alleviate multiple function calls to getGithubFile - so that you could call into it once per page load instead of for each instance on the page. I would like to continue working with you on this if you would like me to.