Skip to content

Instantly share code, notes, and snippets.

View leeight's full-sized avatar
💭
I may be slow to respond.

Li YuBei leeight

💭
I may be slow to respond.
View GitHub Profile
// assumes little endian
// constants taken from http://nikic.github.com/2012/02/02/Pointer-magic-for-efficient-dynamic-value-representations.html
var MAXDOUBLE = 0xfff80000,
INT32TAG = 0xfff90000,
BOOLTAG = 0xfffa0000;
var heap = new ArrayBuffer(24),
f64 = new Float64Array(heap),
ui32 = new Uint32Array(heap),
var assert = console.assert;
var DOUBLE = 0,
INT32 = 1,
BOOL = 2,
PTR = 3;
var MAXDOUBLE = 0xfff80000,
INT32TAG = 0xfff90000,
BOOLTAG = 0xfffa0000,
@leeight
leeight / boot.js
Created June 7, 2014 13:32 — forked from jdx/boot.js
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@leeight
leeight / rAF.js
Created October 12, 2012 04:19 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {