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
Array.prototype.shuffle = function () { | |
var i, j, tempi, tempj; | |
i = this.length; | |
if ( i === 0 ) { | |
return false; | |
} | |
while ( --i ) { | |
j = Math.floor( Math.random() * ( i + 1 ) ); | |
tempi = this[i]; |
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 Class = require('./class'); | |
// This global modifier allows you to treat constructor based classes as if | |
// they were prototype based. | |
// Define an extend method for constructor functions that works like prototype extends. | |
Object.defineProperty(Function.prototype, "extend", {value: function extend(obj) { | |
// Clone the functions's prototype | |
var props = {}, proto = this.prototype; | |
Object.getOwnPropertyNames(proto).forEach(function (key) { |
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
keycode 67 = XF86AudioPrev XF86_Switch_VT_1 F1 | |
keycode 68 = XF86AudioNext XF86_Switch_VT_2 F2 | |
keycode 69 = F5 XF86_Switch_VT_3 F3 | |
keycode 70 = F11 XF86_Switch_VT_4 F4 | |
keycode 71 = XF86AudioPlay XF86_Switch_VT_5 F5 | |
keycode 72 = XF86MonBrightnessDown XF86_Switch_VT_6 F6 | |
keycode 73 = XF86MonBrightnessUp XF86_Switch_VT_7 F7 | |
keycode 74 = XF86AudioMute XF86_Switch_VT_8 F8 | |
keycode 75 = XF86AudioLowerVolume XF86_Switch_VT_9 F9 | |
keycode 76 = XF86AudioRaiseVolume XF86_Switch_VT_10 F10 |
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
From 761f0f03b16f4df0112f4990c38b4f59b2786d04 Mon Sep 17 00:00:00 2001 | |
From: Tim Caswell <tim@creationix.com> | |
Date: Thu, 10 Feb 2011 02:18:13 -0800 | |
Subject: [PATCH] Add support for mutable/implicit headers for http. | |
This works for both ServerResponse and ClientRequest. | |
Adds three new methods as a couple properties to to OutgoingMessage objects. | |
Tests by Charlie Robbins. | |
Change-Id: Ib6f3829798e8f11dd2b6136e61df254f1564807e |
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
define.defs = {}; | |
define.modules = {}; | |
function define(name, fn) { | |
define.defs[name] = fn; | |
} | |
function require(name) { | |
if (define.modules.hasOwnProperty(name)) return define.modules[name]; | |
if (define.defs.hasOwnProperty(name)) { | |
var fn = define.defs[name]; | |
define.defs[name] = function () { throw new Error("Circular Dependency"); }; |
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
// Make a user-space event loop for doing smart event propigation with zero* | |
// race conditions. | |
// | |
// *(If you are unable to get at the event-source, an automatic setTimeout will | |
// be created, and there is a small chance some other native event may get in | |
// before it.) | |
function makeLoop() { | |
// Private // |
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 Box(width, height) { | |
this.width = width; | |
this.height = height; | |
} | |
Box.prototype.getArea = function () { | |
return this.width * this.height; | |
} | |
var box = new Box(3, 5); |
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
startup.customRuntimeMain = function () { | |
var path = NativeModule.require('path'); | |
var custom = path.resolve(process.cwd(), process.argv[0] + ".js"); | |
if (!path.existsSync(custom)) return; | |
process.argv[1] = custom; | |
}; |
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
// glMatrix v0.9.5 | |
glMatrixArrayType=typeof Float32Array!="undefined"?Float32Array:typeof WebGLFloatArray!="undefined"?WebGLFloatArray:Array;vec3={};vec3.create=function(a){var b=new glMatrixArrayType(3);if(a){b[0]=a[0];b[1]=a[1];b[2]=a[2]}return b};vec3.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};vec3.add=function(a,b,c){if(!c||a==c){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2];return a}c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];return c}; | |
vec3.subtract=function(a,b,c){if(!c||a==c){a[0]-=b[0];a[1]-=b[1];a[2]-=b[2];return a}c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];return c};vec3.negate=function(a,b){b||(b=a);b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];return b};vec3.scale=function(a,b,c){if(!c||a==c){a[0]*=b;a[1]*=b;a[2]*=b;return a}c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;return c}; | |
vec3.normalize=function(a,b){b||(b=a);var c=a[0],d=a[1],e=a[2],g=Math.sqrt(c*c+d*d+e*e);if(g){if(g==1){b[0]=c;b[1]=d;b[2]=e;return b}}else{b[0]=0;b[1]=0;b[2]=0;return b}g=1/g;b[0]=c*g;b[1]=d*g;b[2]=e*g;return b};vec3.cross=function(a,b,c |
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
Creationix.route("GET", "/", function (req, res, params, next) { | |
render("frontindex", { | |
title: query("index", "title"), | |
links: query("index", "links"), | |
articles: loadArticles | |
}, function (err, html) { | |
if (err) return next(err); | |
res.writeHead(200, { | |
"Content-Length": Buffer.byteLength(html), | |
"Content-Type": "text/html; charset=utf-8" |
OlderNewer