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 fibonacci = function () { | |
| var memo = [0, 1]; | |
| var fib = function (n) { | |
| var result = memo[n]; | |
| if (typeof result !== 'number') { | |
| result = fib(n-1) + fib(n-2); | |
| memo[n] = result; | |
| } | |
| return result; | |
| } |
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 quote(fn) { | |
| return typeof(fn.name) === "string" ? | |
| fn.name : | |
| fn.toString() | |
| .replace("function ", "") | |
| .replace(/\([\s\S]*/, ""); | |
| } | |
| function funCall(fn) { | |
| var args = Array.prototype.slice.call(arguments, 1), |
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 GenericViewMeta(type): | |
| def __new__(mcs, name, bases, attrs): | |
| cls = type.__new__(mcs, name, bases, attrs) | |
| if hasattr(cls, "decorators"): | |
| decorators = list(cls.decorators) | |
| # Sort the decorators by order they would be applied if using the @ | |
| # syntax. | |
| decorators.reverse() | |
| for d in decorators: | |
| cls.__call__ = d(cls.__call__) |
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
| div = function () { | |
| var args = Array.prototype.slice.call(arguments, 0); | |
| var attrs = {}; | |
| var txt = args.map(function (arg) { | |
| if (typeof arg === "string") { | |
| return arg; | |
| } else { | |
| for (attr in arg) { | |
| attrs[attr] = arg[attr]; | |
| } |
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
| // Based on Nicholas C Zakas' function in High Performance Javascript | |
| function batchProcess(items, process, callback) { | |
| // Create a copy of the original items array so that our side effects | |
| // (calling .shift()) don't pollute anything outside of this scope. | |
| var todo = items.slice(0); | |
| setTimeout(function () { | |
| var start = +new Date, result = true; |
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
| sudo npm publish . | |
| npm configfile /home/fitzgen/.npmrc | |
| npm sudo true | |
| npm cli [ 'publish', '.' ] | |
| npm version 0.1.14 | |
| npm publish [ '.' ] | |
| npm readJson package.json | |
| npm packTar . /usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz | |
| npm exec tar "czf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--exclude" ".git" "wu.js" | |
| npm exec tar "xzf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--strip" "1" "-C" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package" |
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
| sudo npm publish . | |
| npm configfile /home/fitzgen/.npmrc | |
| npm sudo true | |
| npm cli [ 'publish', '.' ] | |
| npm version 0.1.15 | |
| npm publish [ '.' ] | |
| npm readJson package.json | |
| npm packTar . /usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz | |
| npm exec tar "czf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--exclude" ".git" "wu.js" | |
| npm exec tar "xzf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--strip" "1" "-C" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/pac\ |
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
| npm configfile /home/fitzgen/.npmrc | |
| npm sudo true | |
| npm cli [ 'publish', '.' ] | |
| npm version 0.1.15 | |
| npm publish [ '.' ] | |
| npm readJson package.json | |
| npm packTar . /usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz | |
| npm exec tar "czf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--exclude" ".git" "wu.js" | |
| npm exec tar "xzf" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/package.tgz" "--strip" "1" "-C" "/usr/local/lib/node/.npm/.cache/wu/0.1.1/pac\ | |
| kage" |
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 (arg) { return arg === undefined; }()) // Missing arguments are undefined | |
| true | |
| > var items = [] | |
| undefined | |
| > items.push() // Pushing implicitly undefined item doesn't work | |
| 0 | |
| > items | |
| [] | |
| > items.push(undefined) // What about explicitly pushing undefined? | |
| 1 |
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 | |
| test = test || null, | |
| ok = ok || null, | |
| deepEqual = deepEqual || null, | |
| assert = null; | |
| // If we are not running in Qunit in the browser, create a shim from the Qunit API | |
| // to the CommonJS API. | |
| if (typeof exports !== "undefined") { | |
| assert = require("assert"); |
OlderNewer