I just discovered this amazing site http://www.readingcodegood.com/ and watched the talk, it's very inspire. She gives good examples of Ruby that is nearly ~ 100 line of code. I just want to do this exercise with JavaScript and I want to get some very good and clean JavaScript code to read and learn from. Any suggestions?<p>Thanks
In general there are two types of JS code bases you'll encounter, the ones for the Browser which end up putting everything into a single file and the ones for Node.js, which (in most cases) organize their code in the usual directory / file structures you may be used too from other programming languages.<p>There are also multiple camps which battle about whether too use semicolons at all and where to place commas that separate the individual parts of `var` statements. I'm not going to take any sides here, since I think that style is something everyone has to decide on their own :)<p>Now as for the code to read, there's obviously jQuery, but Angular.js is definitely a good read too these days.<p><a href="https://github.com/angular/angular.js" rel="nofollow">https://github.com/angular/angular.js</a><p>If you're into parsing (or want to learn about it), there's also Esprima which is a JavaScript Parser written in JavaScript:<p><a href="https://github.com/ariya/esprima" rel="nofollow">https://github.com/ariya/esprima</a><p>Taking a look at NPM might give you an idea of another syntax style, since commas are infront of the lines here and there are no semicolons:<p><a href="https://github.com/npm/npm/tree/master/lib" rel="nofollow">https://github.com/npm/npm/tree/master/lib</a><p>And last but no least a shameless plug or two!<p>gbaasm this is a assembler for z80 GameBoy code (which takes assembly files and build a ROM) written by myself, it has a big focus on performance and is another example of lexing / parsing source code.<p><a href="https://github.com/BonsaiDen/gbasm" rel="nofollow">https://github.com/BonsaiDen/gbasm</a><p>For something short and sweet I got a minimal 2D physics engine here. Beware though, if you're new to physics simulation is can be quite hard to figure out what excactly is going on:<p><a href="https://github.com/BonsaiDen/box" rel="nofollow">https://github.com/BonsaiDen/box</a>
I believe this was posted on HN a while back but check out this video and the jQuery repo. It's actually very, very interesting.<p><a href="http://www.paulirish.com/2010/10-things-i-learned-from-the-jquery-source/" rel="nofollow">http://www.paulirish.com/2010/10-things-i-learned-from-the-j...</a>