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
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(['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
// hooking up xml2json to convert XML piped in via stdin to JSON on stdout | |
// e.g.: | |
// curl http://www.gutenberg.org/feeds/today.rss | node index.js > gutenberg.json | |
var x2j = require("xml2json"); | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
var xml = ''; |
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
/** | |
* Module dependencies. | |
*/ | |
var fs = require('fs'), | |
path = require('path'); | |
spawn = require('child_process').spawn, | |
exec = require('child_process').exec; | |
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(){ | |
var sys = require('sys'); | |
var filestem = process.ARGV.length > 2 ? process.ARGV.length[2] : "screen"; | |
var spawn = require('child_process').spawn, | |
timer = null, | |
startTime, stopTime; | |
function outfile(d) { |
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
#!/usr/bin/perl | |
# quick, throwaway script to extract out info messages from the HTML dump of the | |
# firebug console which is produced by the ConsoleExport Firefox/Firebug | |
# plugin. | |
# I was interested in info message of the form.. so its pretty specific | |
# console.info("some label:87ms", 113, 200); | |
# TODO provide a way to extract log/warn/info/error/all entry types |
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 mockMethod = function(obj, methName, fn) { | |
var orig = obj[methName]; | |
var handle = [obj, methName, orig]; | |
obj[methName] = fn; | |
return handle; | |
}, unMockMethod = function(handle) { | |
handle[0][handle[1]] = handle[2]; | |
}; | |
// usage: |
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
getValue: function(/*Object*/ item, /*String*/property, /*value?*/defaultValue){ | |
// summary: | |
// Gets the value of an item's 'property' | |
// | |
// item: | |
// The item to get the value from | |
// property: | |
// property to look up value for | |
// defaultValue: | |
// the default value |
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
dojo.provide("myns.data.FeedStore"); | |
dojo.require("dojox.data.ServiceStore"); | |
dojo.require("dojox.rpc.Service"); | |
dojo.declare("myns.data.FeedStore", dojox.data.ServiceStore, { | |
// summary: | |
// Flexible, extensible store for normalizing read-only JSON feed data | |
service: null, |