Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");

Javascript

Javascript: The Good Parts -- Beginner/Intermediate

http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742

Legendary book, a must-read for any Javascript programmer at least once. Goes into the basics of Javascript with the assumption that the reader is an experienced programmer already, coming from another language or already understands a fair bit about Javascript itself. Very good review of basics and more advanced concepts (like scope/closure, functions as first class objects, etc).

Javascript Design Patterns (Stoyan Stefanov) -- Intermediate

/*
Here are some short exercises to give you extra practice writing SCSS, and especially with refactoring regular CSS into SCSS.
You can double-check your SCSS by plugging it into Sassmeister, and see if the compiled CSS matches the starting point code:
http://www.sassmeister.com/
The Sass documentation is a great resource and can be found here: http://sass-lang.com/documentation/
*/
/*
Example - Write the following CSS using nested rules: