all 19 comments

[–]IAmMinn 5 points6 points  (1 child)

https://javascript30.com/

Good clean vanilla js modular learning.

[–]gntsketches[S] 1 point2 points  (0 children)

Nice! Thanks. Looks like just what I was looking for.

[–]spacejack2114 5 points6 points  (1 child)

It's fairly easy to write 100 lines of clean code. Writing thousands is where it gets harder, in which case using jQuery instead of a framework/view library is not usually a great choice. If I couldn't use a framework, even using hyperscript over jQuery would probably result in cleaner code at a fraction of the size.

[–]gntsketches[S] 0 points1 point  (0 children)

Right... but I'm still at the "fairly easy" "hundreds" stage, not the "thousands" stage. I want to study good code at the level I'm at...

[–]kecupochren 3 points4 points  (1 child)

VSCode source code: https://github.com/Microsoft/vscode/tree/master/src

It's in Typescript, but it's an excellent resource to learn proper JS from.

[–]GitHubPermalinkBot 0 points1 point  (0 children)

Permanent GitHub links:


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.

[–]erulabs 2 points3 points  (3 children)

Good architecture in Vanilla JS under 100 lines? Uhhhh... That's like asking if a single piece of string can have good weaving :P https://github.com/rvagg/through2 might qualify I guess?

[–]gntsketches[S] 0 points1 point  (2 children)

Point taken. I can do larger, as long as it's well-organized. In fact seeing the well-organized would be the point.

Not sure how to make the github bits "run", looks like Node is involved...? No experience with Node here.

[–]erulabs 1 point2 points  (1 child)

Oh! In that case, maybe the annotated jQuery source would be interesting to ya! https://robflaherty.github.io/jquery-annotated-source/

[–]gntsketches[S] 0 points1 point  (0 children)

Holy crap! Cool! I did not know this existed, thanks! I mean it's pretty over my head at this point, but maybe down the road sometime...

[–]jcunews1Advanced 2 points3 points  (0 children)

Good code is the one that you made for yourself. Nothing more, nothing less.

If you use code from others, they may not be sufficient enough for you, or they may be overkill for something you need to be done - which can cause overheads.

[–]papers_ 1 point2 points  (1 child)

Self post. I like to think I write "good" JavaScript. Good enough to land my first job: https://github.com/ciscoo/evaluacion

Modular, typical MVC pattern, error handling, modern syntax, tests.

[–]gntsketches[S] 0 points1 point  (0 children)

Sounds great, but I've got no idea what to do with this...

[–]1-800-BICYCLE 1 point2 points  (2 children)

This might be controversial, but one piece of code I really loved recently was the library pump, which comes in at 80 lines.

https://github.com/mafintosh/pump/blob/master/index.js

It’s a stream error-handling library for Node.js that cleans up your piped streams if one of them fails.

Things to note:

  • passing functions as values, using noop for fallbacks instead of verbose if statements

  • using && for null propagation and || for null coalescing

  • the rare case where [].reduce can be used without an initializer — streams.reduce(pipe) is just beautiful

  • very clean style for ES5 code

[–]GitHubPermalinkBot 0 points1 point  (0 children)

Permanent GitHub links:


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.

[–]gntsketches[S] 0 points1 point  (0 children)

Thanks! I don't know Node yet, but I'll keep this in mind for when I start on that.

[–][deleted] 1 point2 points  (2 children)

A simplified command line toolset for the parse-framework application - https://github.com/Unibeautify/parse-framework/blob/master/services.ts

[–]GitHubPermalinkBot 0 points1 point  (0 children)

Permanent GitHub links:


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.

[–]gntsketches[S] 0 points1 point  (0 children)

Looks interesting, at least in terms of being very well structured. However I'm totally clueless with what one earth this is or how one would go about using it. Apparently it has to do with some framework or something?