Couldn't find the text of this for a while...
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
/x/==x |
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 repeat(obj, times) { | |
var res = typeof obj == 'string' ? '' : []; | |
times = Math.max(1, times); | |
do { | |
if (times & 0x1) res = res.concat(obj); | |
obj = obj.concat(obj); | |
} while ((times >>= 1)); | |
return res; | |
} |
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 valueRange(start, end) { | |
return function (value) { | |
return Math.min(Math.max(value, start), end); | |
}; | |
} | |
//Get new value range [0, 20] | |
var f = valueRange(0, 20); | |
console.log(f(10)); //10 |
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 ctor(fn) { | |
function F () { | |
var obj = Object.create(F.prototype); | |
fn.apply(obj, arguments); | |
return obj; | |
} | |
F.prototype = Object.create(fn.prototype); | |
return F; | |
} |
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
var GO = 'GO', | |
OK = 'OK', | |
SIGN = 'SIGN', | |
LZERO = 'LZERO', | |
INT = 'INT', | |
FRAC = 'FRAC', | |
FDIG = 'FDIG', | |
EXP = 'EXP', | |
XSIGN = 'XSIGN', | |
EDIG = 'EDIG', |
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
#!/usr/bin/env perl | |
use common::sense; | |
use PPI; | |
my $file = shift; | |
die "Need a file to operate on\n" | |
if !$file | |
|| !-f $file; | |
my $doc = PPI::Document->new($file); |
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
var slice = Array.prototype.slice | |
function iterativelyWalk(nodes, cb) { | |
nodes = slice.call(nodes) | |
while(nodes.length) { | |
var node = nodes.shift(), | |
ret = cb(node) | |
if (ret) { |
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
<html> | |
<body> | |
<script type="text/javascript" charset="utf-8"> | |
// CONSOLE log | |
var foo = {baz: "tubular", goo: "rad"}, bar = "baz"; | |
console.log("string",1,foo.goo,bar,foo.baz); // string 1 rad baz tubular | |
console.log(foo) | |
// CONSOLE Printf | |
var foo = {baz: "tubular", goo: "rad"}, bar = "baz"; |