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
# == 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
### | |
! 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
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
(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 A = Function.inherit(function () { | |
console.log('construct A'); | |
}, { | |
'aa': function () { | |
console.log('aa A'); | |
}, | |
}); | |
var B = A.inherit(function () { | |
console.log('construct B'); |
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
/** | |
* Shortcut Library | |
* -- | |
* @version 2.01.B | |
* @author Binny V A | |
* @modifier Jan Kuča <jan@jankuca.com> | |
* @license BSD | |
*/ | |
(function (window) { | |
var document = window.document; |
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('uuid'); | |
var uuid = function () { | |
var parts = new Array(4); | |
// a - unix timestamp | |
var time = Math.round(new Date().getTime() / 1000); | |
parts[0] = time.toString(16).substring(0, 8); |
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
exports.parse = function (string, format) { | |
var match = string.match(/^(\+|-)\s*(\d+)\s*([a-z]{3})/i); | |
var add; | |
if (!match) { | |
add = 0; | |
} else { | |
add = parseInt(match[2], 10); | |
switch (match[3]) { | |
case 'min': | |
add *= 60; |
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 rsplit = function (string, regex) { | |
var result = regex.exec(string), | |
retArr = [], | |
first_idx, | |
last_idx, | |
first_bit; | |
while (result !== null) { | |
first_idx = result.index; | |
last_idx = regex.lastIndex; | |
if (first_idx !== 0) { |