This file contains 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 () { | |
var modules = {}, cache = {}; | |
if (typeof define == 'undefined') { | |
window.define = function (id, factory) { | |
modules[id] = factory; | |
}; | |
window.require = function (id) { | |
var module = cache[id]; | |
if (!module) { | |
module = cache[id] = {}; |
This file contains 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
# use the split-generics branch of prime. | |
wrup -r prime ../../www/prime/index.js -r bind ../../www/prime/function/bind -o prime.js |
This file contains 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 multiply(multiplicant, multiplier){ | |
var product = 0; | |
for (var i = 0; i < 32; i++){ | |
product += (multiplier & 1) ? multiplicant : 0; | |
multiplicant <<= 1; | |
multiplier >>= 1; | |
} |
This file contains 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
"use strict"; | |
if (typeof DEV == 'undefined') return; | |
function assert(condition, message){ | |
if (!condition) throw new Error(message || "Assertion fault"); | |
} | |
exports.assert = assert; |
This file contains 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
node_modules/ |
This file contains 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
//arian@arian-sys:~/www/wrapup (master) $ ./node_modules/.bin/uglifyjs test.js --compress --mangle --define ES5=false | |
//WARN: Condition always true [test.js:6,34] | |
//WARN: Dropping unreachable code [test.js:9,2] | |
function foo(){console.log("es5")} |
This file contains 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
for (expr1; expr2; expr3) { | |
// do thing | |
} | |
expr1 | |
while (expr2) { | |
// do thing | |
expr3 | |
} |
This file contains 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 http://geeknme.wordpress.com/2009/10/15/getting-started-with-upstart-in-ubuntu/ | |
description "start and stop the nodejs server" | |
version "1.0" | |
author "Arian Stolwijk" | |
# tell upstart we're creating a daemon | |
# upstart manages PID creation for you. | |
expect fork | |
script |
This file contains 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
# add ~/bin to path | |
PATH=$PATH:/home/arian/bin | |
# use all 256 colors | |
if [ -n "$DISPLAY" -a "$TERM" == "xterm" ]; then | |
export TERM=xterm-256color | |
fi | |
function git_prompt { | |
local STATUS=`git status 2>&1` |
This file contains 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
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var slick = require('slick'); | |
var sMyString = "<foo><bar></bar></foo>"; | |
var oParser = new DOMParser(); | |
var oDOM = oParser.parseFromString(sMyString, "text/xml"); | |
console.log(slick('bar', oDOM)); |