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 EventEmitter = require('events').EventEmitter | |
var Mutex = function() { | |
var queue = new EventEmitter(); | |
var locked = false; | |
this.lock = function lock(fn) { | |
if (locked) { | |
queue.once('ready',function() { | |
lock(fn); | |
}); | |
} else { |
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 sys = require('sys') | |
var EventEmitter = require('events').EventEmitter | |
var func = function(arg1, arg2) { | |
if(arg1 === undefined && arg2 === undefined) { | |
sys.puts("I was called without parameters"); | |
} | |
}; | |
var emitter = new EventEmitter(); | |
emitter.on('test',func) |
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 A = function A() {}; | |
var B = function B() {}; | |
B.prototype = new A(); | |
// B.prototype.constructor = B; // only way I can find to get bi's constructor to be B. Comment or uncomment this line to produce exactly the same output for both tests. It doesn't matter. | |
// require('util').inherits(B, A); // same here. Comment or uncomment it doesn't make a difference. | |
var ai = new A(); | |
var bi = new B(); | |
console.log('Test 1: constructor directly'); |
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
window.module = (function() { | |
var module = {}; | |
var modules = {}; | |
module.require = function require(mod_name) { | |
return modules[mod_name]; | |
}; | |
module.declare = function declare(f) { | |
if(typeof f === 'function') { | |
var m = {}; |
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
require.async = function require_async(module, continuation) { | |
//quick! pretend to be async! | |
continuation(require(module)); | |
//alternately, actually be async: | |
//process.nextTick(function() { | |
// continuation(require(module)); | |
//}); | |
}; |
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
elarkin-vibes:splat evan.larkin$ gem install soap4r --version '= 1.5.8' | |
Abort trap | |
elarkin-vibes:splat evan.larkin$ rake gems:install --trace | |
(in /Users/evan.larkin/source/splat) | |
** Invoke gems:install (first_time) | |
** Invoke gems:base (first_time) | |
** Execute gems:base | |
** Invoke environment (first_time) | |
** Execute environment | |
=> QueryTrace disabled; CTRL-\ to toggle |
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
gem install --version '= 2.3.11' rails | |
gem install --version '= 1.0.4' uuid | |
gem install validatable | |
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
gem install --version '2.4.4' facets | |
gem install --version '4.0.0' htmlentities | |
gem install httpclient --version '= 2.1.2' | |
gem install --version '= 0.9.8' mocha | |
gem install --version '= 1.2.6' fakeweb | |
gem install --version '= 2.2.0' fattr |
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
source :rubygems | |
gem "chronic", "0.2.3" | |
gem "main", "4.7.1" |
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 child_process = require('child_process'); | |
var child = child_process.fork('./slave.js'); | |
child.on('exit', function() {console.log(1)}) |
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
#in application.rb | |
module YourApp | |
class Application < Rails::Application | |
config.middleware.insert_before ActionDispatch::ParamsParser, "ParsingFailureToJSON" | |
... | |
end | |
end | |
#The Parsing failure middleware | |
class ParsingFailureToJSON |
OlderNewer