bonus tip: for more darkness > https://darkreader.org/
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
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
// 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!"); |
/* 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)); }; |
// Hello. There is now a module for this. | |
// https://github.com/0x8890/error-class | |
// $ npm install error-class | |
const hasCaptureStackTrace = 'captureStackTrace' in Error | |
// Internal function to set up an error. | |
function setup (message) { | |
const { constructor, constructor: { name } } = this |
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers']) | |
.run(function(DB) { | |
DB.init(); | |
}); |
# ... | |
ADD package.json /tmp/package.json | |
RUN cd /tmp && npm install && \ | |
mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/ | |
# ... | |
WORKDIR /opt/app | |
ADD . /opt/app |
import urllib2 | |
import sys | |
def cleanupString(string): | |
string = urllib2.unquote(string).decode('utf8') | |
return HTMLParser.HTMLParser().unescape(string).encode(sys.getfilesystemencoding()) |
#How to install node.js and CouchDB on a Google Compute Engine instance
Make sure you have a Google Compute engine account, have a project created and the gcutil command line tool installed.
Since want to ssh without the gcutil tool, you need to a your ssh key to the instance in addition to the already existing google_compute_engine key (used for gcutil).