I’ll give some context on what we are trying to achieve and the steps we have taken so far.
Related issues we have filled on this issue:
var positioned = ['x', 'y']; | |
// an parameter object is full if the domain does not contain any falsies | |
function isFull(object) { | |
return _(object) | |
.omit(_.identity) | |
.keys() | |
.value() | |
.length; | |
} |
I’ll give some context on what we are trying to achieve and the steps we have taken so far.
Related issues we have filled on this issue:
function spreadable(f) { | |
return function() { | |
return f.apply(null, _.flattenDeep(arguments)) | |
}; | |
} | |
var a = spreadable(function (a, b, c, d, e, f, g, h) { | |
return [a, b, c, d, e, f, g, h]; | |
}); |
function add(a, b, c) { | |
return a + b + c; | |
} | |
console.log( add.apply(null, [1, 2, 3]) ); | |
// 6 | |
console.log( add.call(null, 2, 3, 4) ); | |
// 9 |
function point(x, y) { | |
return { | |
x: x, y: y, | |
shift: function(x, y) { | |
return _.extend({}, this, { | |
x: this.x + x, | |
y: this.y + y | |
}) | |
} |
function animate(fn) { | |
var halted = false; | |
var f = function() { | |
fn(); | |
if (!halted) requestAnimationFrame(f); | |
} | |
f(); |
<html> | |
<head> | |
<script type="text/javascript" src="../lib/jqueryui/js/jquery-1.7.1.min.js"></script> | |
<script type="text/javascript" src="../lib/drawer.js"></script> | |
</head> | |
<body> | |
function mandelbrotRank (x, y, timeout) { | |
var i = 0, | |
zx = x, | |
zy = y; | |
while (zx*zx + zy*zy < 4 && i < timeout){ | |
zx = zx*zx - zy*zy + x + offx; | |
zy = 2*zx*zy + y + offy; | |
i += 1; | |
} |
var CANVAS_CTX = canvas.getContext('2d'); | |
var DRAW_PIXEL_ID = CANVAS_CTX.createImageData(1,1); | |
var DRAW_PIXEL_DATA = DRAW_PIXEL_ID.data; | |
function drawPixel(ctx, x, y, r, g, b, a) { | |
DRAW_PIXEL_DATA[0] = r; | |
DRAW_PIXEL_DATA[1] = g; | |
DRAW_PIXEL_DATA[2] = b; | |
DRAW_PIXEL_DATA[3] = a; | |
ctx.putImageData( DRAW_PIXEL_ID, x, y ); |
Practicing underscore foo... | |
checkErrors: function(attrs) { | |
var errors = []; | |
_.each(this.basicValidationFields, function(key) { | |
errors.push(this.validatePresence(key, attrs[key])); | |
}.bind(this)); | |
errors = _.compact(errors); | |
if (errors.length) return errors; |