TL;DR: If you want to see me perform a spoken word poem about JavaScript in front of 1000 people (and on video), please ⭐ star this gist. If you're on mobile, you'll need to request desktop site.
| const t = require("tcomb"); | |
| // imstruct is a tcomb type builder that internally builds an | |
| // Immutable.Record object, but applies tcomb's type system to it | |
| const imstruct = require("../util/imstruct"); | |
| const Person = imstruct({ | |
| name: t.String, | |
| age: t.Number | |
| }); | 
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| function range(n) { | |
| return Array.apply(null, Array(n)).map(function (_, i) { return i }) | |
| } | |
| function ntuples(n, xs) { | |
| return range(Math.ceil(xs.length / n)).map(function (i) { | |
| return xs.slice(i * n, i * n + n) | |
| }) | |
| } | 
| function range(/* [begin,] end[, step] */) { | |
| var begin = arguments.length > 1 ? arguments[0] : 0, | |
| end = arguments.length > 1 ? arguments[1] : arguments[0], | |
| step = arguments[2] || 1, | |
| n = Math.max(0, Math.ceil((end - begin) / step)) | |
| return Array.apply(null, Array(n)).map(function (_, i) { | |
| return begin + step * i | |
| }) | |
| } | 
| // Public domain. | |
| // Attribution welcome, but not required. -- Pyry Jahkola. | |
| // What's the point in all this? To get the equivalent of CoffeeScript's | |
| // (?.) operator into vanilla JavaScript. | |
| // get(x, key1, key2, ...) -- Get the result of x[key1][key2]..., or undefined. | |
| // Will short circuit if a key is not found. | 
| brew update | |
| brew versions FORMULA | |
| cd `brew --prefix` | |
| git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
| brew install FORMULA | |
| brew switch FORMULA VERSION | |
| git checkout -- Library/Formula/FORMULA.rb # reset formula | |
| ## Example: Using Subversion 1.6.17 | |
| # | 
| /* | |
| * Normalized hide address bar for iOS & Android | |
| * (c) Scott Jehl, scottjehl.com | |
| * MIT License | |
| */ | |
| (function( win ){ | |
| var doc = win.document; | |
| // If there's a hash, or addEventListener is undefined, stop here | |
| if( !location.hash && win.addEventListener ){ | 
| def eq_diff(a, b): | |
| import json, difflib | |
| from datetime import datetime | |
| if a == b: | |
| return | |
| class DatetimeEncoder(json.JSONEncoder): | |
| def default(self, o): | |
| if isinstance(o, datetime): |