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 D = document | |
, body = D.body | |
, canvas = D.body.appendChild(D.createElement('canvas')) | |
, ctx = canvas.getContext('2d') | |
, width = 480 | |
, height = 272 | |
; | |
function vendorStyle (ele, prop, val) { | |
var caps = prop.charAt(0).toUpperCase() + prop.slice(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
(function () { | |
var w = window | |
, d = document | |
, b = d.body | |
, h = d.getElementsByTagName('head')[0] | |
, s = d.getElementsByTagName('script') | |
, c = {} // cache | |
, m // main | |
, i // iter | |
, x = /\.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
//TODO: add object checks | |
searchTree function (node, getChildren, test) { | |
function find (node, parent) { | |
var kids = getChildren(node), i, ret = null; | |
if (test(node)) { return { parent: parent, match: node }; } | |
if (kids.length < 1) { return null; } | |
for (i=0; i<kids.length; i++) { | |
ret = find(kids[i], node); | |
if (ret) { return 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
var ply = function (raw) { | |
this.raw = raw; | |
this.parse(); | |
}; | |
ply.prototype.regex = { | |
newline: /\n/, | |
space: /\s+/, | |
leadspace: /^\s+/, | |
trailspace: /\s+$/, |
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
# cube.obj | |
# | |
g cube | |
v 0.0 0.0 0.0 | |
v 0.0 0.0 1.0 | |
v 0.0 1.0 0.0 | |
v 0.0 1.0 1.0 | |
v 1.0 0.0 0.0 |
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
Object.prototype.hasPwnProperty = function (prop) { return (prop in this && !this.hasOwnProperty(prop)); }; |
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 EX = function (expr) { | |
var result | |
, operands = {} | |
, operVals = Array.prototype.slice.call(arguments, 1) | |
, operSetFuncs = {} | |
; | |
function genResult () { | |
result = expr.apply(null, Object.keys(operands).map(function(v) { | |
return operands[v]; |
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 ChronoTron(conf) { | |
function gots (name, type) { | |
return ( | |
(type === 'Array') ? | |
conf[name] instanceof Array : | |
conf[name] && typeof conf[name] === type | |
); | |
} | |
switch (true) { | |
case typeof conf !== 'object': |
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 repeatAcc(n,f) { | |
var accum = []; for (; n>0; n--) { accum.unshift(f(n)); } | |
return accum; | |
} |
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 between (n,l,h) { return n >= l && n <= h; } | |
function timesDo (n, f) { for (; n>0; n--) { f(n); } } | |
function repeatAcc(n,f) { var accum = []; for (; n>0; n--) { accum.unshift(f(n)); } return accum; } |
OlderNewer