I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).
| /** | |
| * So, obviously this is by no means a "new trick", | |
| * but encapsulation in classes works the same as | |
| * it does in "Modules" (IIFE pattern): You hide them | |
| * in a scope, and define the methods that need access | |
| * to them within that same scope. The constructor is | |
| * as good a place as any for that. | |
| */ | |
| import _ from 'underscore'; |
| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
| // 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!"); |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft,elem.offsetTop,elem.offsetWidth,elem.offsetHeight,elem.offsetParent
These are the Kickstarter Engineering and Data role definitions for both teams.
| import { combineReducers } from 'redux'; | |
| import users from './reducers/users'; | |
| import posts from './reducers/posts'; | |
| export default function createReducer(asyncReducers) { | |
| return combineReducers({ | |
| users, | |
| posts, | |
| ...asyncReducers | |
| }); |
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
A quick guide on how to setup Node.js development environment.
nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.
- Open new Terminal window.
| //////////////////////////////////////////////////////////////////////// | |
| // Intro | |
| /////////////////////// | |
| // Tools like Redux-saga, React-redux and Reselect can easily be used without Redux | |
| // For Reselet there's nothing to do, it's just not coupled to Redux | |
| // For the others, you just need to provide an adapter | |
| // At Stample.co we use a legacy framework that is quite close to Redux but with a bad API | |
| // We want to progressively migrate to Redux, so starting now to use Redux tools on new features will make our migration faster |