Download the files, run them on a local server (python -m SimpleHTTPServer
works fine), and open up index.html
.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toArray(args) { | |
return [].slice.call(args); | |
} | |
function autocurry(fn) { | |
var len = fn.length; | |
var args = []; | |
return function next() { | |
args = args.concat(toArray(arguments)); | |
return (args.length >= len) ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require("bluebird"); | |
var fs = require("fs"); | |
Promise.promisifyAll(fs); | |
// fs.readFileAsync("file.js", "utf8").then(...) | |
var readFileTree = function ( root ) { | |
var results = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bill extends Backbone.Model | |
initialize: ( id ) -> | |
@id = id; | |
@_when = $.when( @getAmendments(), @getVotes() ) | |
then: ( callback ) -> | |
@_when.then( callback ) | |
@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createObservedObject = function(callback) { | |
var obj = {}; | |
var args = [].slice.call(arguments, 1); | |
for(var i in args) { | |
var thisPropertyName = args[i]; | |
(function(thisPropertyName) { | |
obj['_' + thisPropertyName] = undefined; | |
Object.defineProperty(obj, thisPropertyName, { | |
get: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JQueryInheritor extends jQuery | |
constructor: ( arg ) -> | |
jQuery.fn.init.call( this, arg ); | |
myMethod = -> | |
# do something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function $( selector, context ) { | |
return [].slice.call( ( context || document ).querySelectorAll( selector ) ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, factory) { | |
// Set up Module appropriately for the environment. Start with AMD. | |
if (typeof define === 'function' && define.amd) { | |
define(['underscore', 'exports'], function(_, exports) { | |
// Export global even in AMD case in case this script is loaded with others that may still expect a global "Module". | |
root.Module = factory(root, exports, $); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pairs = ( obj ) -> | |
arr = [] | |
for own key, val of obj when key isnt "id" | |
arr.push "#{ key }=#{ val}" | |
arr.join "," | |
makeORMClass = ( table ) -> | |
# CoffeeScript syntactic sugar for class creation. | |
class Model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var first = (function() { | |
var chainNames = ["then", "andThen", "next"]; | |
var endChainNames = ["finally", "andFinally", "last"]; | |
var chain = function(fn) { | |
var f1 = function(g) { | |
var func = function() {return g.call(this, fn.apply(this, arguments));}; | |
chain(func); | |
return func; | |
}; | |
var f2 = function(g) { |