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 () { | |
if (!Object.defineProperty) return; | |
Object.defineProperty(Function.prototype, 'initializing', { | |
value: false, | |
writable: true | |
}); | |
Object.defineProperty(Function.prototype, '$super', { | |
value: function () { |
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 HTTPS = require('https'); | |
var QueryString = require('querystring'); | |
/** | |
* Facebook API Wrapper | |
* @constructor | |
* @param {Object} info Info about the Facebook application | |
*/ | |
var Client = function (info) { | |
if (!info.id) { |
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
### | |
! Object Events | |
! == | |
! A little abstraction layer that connects all Object instances | |
! to the native event engine and adds custom event support. | |
! -- | |
! Author: Jan Kuča <jan@jankuca.com>, http://jankuca.com | |
! Version: 1.0 | |
! Last revision: 05 Jun 2011 | |
### |
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
# == Synchronous loop == | |
# It does the same as forEach. | |
input = ['a', 'b', 'c'] | |
output = {} | |
iter = new Iterator input, (item, next, i) -> | |
output[item] = item | |
console.log 'Finished iteration ' + i | |
do next | |
iter.run -> |
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 parseInput() { | |
var input = { | |
modes: [], | |
args: [], | |
params: {}, | |
}; | |
var param_key = null; | |
var parts = process.argv.slice(2); | |
parts.forEach(function (part) { |
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
goog.provide('Deferred'); | |
/** | |
* Handles deferred calls | |
* @constructor | |
*/ | |
var Deferred = function () { | |
this.pending_ = []; | |
this.completed = false; | |
this.status = null; |
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 stdout = process.stdout; | |
var info = console.info; | |
var warn = console.warn; | |
var error = console.error; | |
var DEFAULT = "\033[m"; | |
var BLUE = "\033[1;34m"; | |
var YELLOW = "\033[1;33m"; | |
var RED = "\033[1;31m"; |
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 http = require('http'); | |
var gzip = require('http-gzip'); | |
var server = http.createServer(function (req, res) { | |
gzip(req, res); | |
res.writeHead(200, { | |
'content-type': 'text/plain' | |
}); | |
res.write('I am gonna be gzip encoded, dude!'); |
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
Object.defineProperty(Function.prototype, 'initializing', { | |
value: false, | |
writable: true, | |
}); | |
Object.defineProperty(Function.prototype, '$super', { | |
value: function () { | |
throw new Error('The $super method is not available.'); | |
}, | |
writable: true, | |
}); |
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
/** | |
* @constructor | |
*/ | |
function Injector() { | |
/** | |
* @type {!Object.<string, function(Injector=): !Object>} | |
*/ | |
this.factories = {}; |