This file contains hidden or 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(['lib/Scene'], function(Scene){ | |
describe("Scene", function() { | |
var scene; | |
beforeEach(function() { | |
scene = new Scene(); | |
}); | |
it("should instantiate ok", function() { |
This file contains hidden or 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 express = require("express"), | |
jsonp = require("connect-jsonp"), | |
path = require('path'), | |
argv = require('optimist').argv; | |
// delegation the way I like it | |
var delegate = function(proto, mixin){ | |
var o = Object.create(proto); | |
if(mixin){ |
This file contains hidden or 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(['compose'], function(Compose){ | |
var cache = {}; | |
exports = Compose(Compose, function(){ | |
var id = this.id = MyClass.nextId(); | |
cache[id] = {}; | |
}, { | |
someMethod: function(){ | |
var id = this.id, |
This file contains hidden or 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(){ | |
// usage: | |
// dojo.create("script", { src: 'https://raw.github.com/gist/1267150/b786273d696a119bba26c4590b1608aa9a21755f/gistfile1.txt?'+(new Date).getTime(), type: 'text/javascript' }, dojo.query("head", document.documentElement).shift()) | |
var labelMap = {}; | |
dojo.query("label[for]").forEach(function(lbl) { | |
labelMap[lbl.htmlFor]=lbl; | |
}); | |
console.log("labelMap: ", labelMap); | |
var selector = [ | |
"input[type=text]", |
This file contains hidden or 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 domQuery(selector, scopeNode){ | |
// summary: | |
// Wrap dojo.query to provide support for the :eq() pseudo-selector | |
// See: http://api.jquery.com/eq-selector/ | |
var reEqPseudo = /:eq\((\d+)\)/, | |
results = new dojo.NodeList; | |
scopeNode = scopeNode || dojo.doc.documentElement; |
This file contains hidden or 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
diff --git a/js/Steppe/Renderer.js b/js/Steppe/Renderer.js | |
index 77bf78b..22f16bc 100644 | |
--- a/js/Steppe/Renderer.js | |
+++ b/js/Steppe/Renderer.js | |
@@ -361,20 +361,15 @@ var Steppe = (function(Steppe) { | |
(top * (framebufferImageData.width << 2)) + | |
(ray << 2); | |
- | |
- var bufferR = (color >> 24) & 0xff, |
This file contains hidden or 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
/** | |
* grid essentials | |
*/ | |
.row { | |
letter-spacing: -0.31em; /* webkit: collapse white-space between units */ | |
*letter-spacing: normal; /* reset IE < 8 */ | |
word-spacing: -0.43em; /* IE < 8 && gecko: collapse white-space between units */ | |
} | |
.col { |
This file contains hidden or 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 map(obj, fn, thisArg){ | |
// suggest you polyfill if you need Javascript < 1.6 | |
var result = {}; | |
if(obj instanceof Array){ | |
result = obj.map(fn, thisArg || null); | |
} else { | |
Object.keys(obj).forEach(function(key){ | |
result[key] = fn.call(thisArg || null, obj[key], key, obj); | |
}); | |
} |
This file contains hidden or 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> | |
<head><title>Async unit testing with task.js (exploration)</title></head> | |
<script type="application/javascript" src="https://raw.github.com/mozilla/task.js/master/lib/task.js"></script> | |
<script type="application/javascript;version=1.8"> | |
function go() { | |
var { spawn, join, TaskResult, Deferred } = task; | |
var mydata = { foo: "bar" }; | |
// shared functions for test setup |
This file contains hidden or 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 palette1 = ("white,green,brown,blue,orange").split(','), | |
palette2 = ("cyan,orange,black,white").split(','), | |
palette3 = ("black,white,grey").split(','); | |
// given one or more arrays of values, | |
// return an array with only those values present in each | |
function intersection() { | |
var lists = Array.prototype.slice.call(arguments); | |
return lists.reduce(function(aCommon, aValues){ | |
var overlap = aValues.filter(function(val){ |