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 parent = function() { | |
var spawn = require('child_process').spawn; | |
var child = spawn(process.execPath, [process.argv[1], 123]); | |
var stdout = ''; | |
var stderr = ''; | |
child.stdout.on('data', function(buf) { | |
console.log('[STR] stdout "%s"', String(buf)); | |
stdout += buf; | |
}); | |
child.stderr.on('data', function(buf) { |
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
// Using the $.when() method, we can create an object that behaves similarly | |
// to Deferred objects, but for COMBINATIONS of Deferred objects. | |
// | |
// The $.when() method creates a Deferred object that is resolved or rejected | |
// when all the Deferred objects passed into it are resolved or rejected. | |
var getPromise = function(name) { | |
var dfd = $.Deferred(); | |
var num = Math.floor(Math.random() * 1000); | |
setTimeout(function() { dfd.resolve(name + ": " + num); }, num); | |
return dfd.promise(); |
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
$("#target").html("<h2 class=well>OMG AWESOME CROSS-DOMAIN TEST JQUERYIES</h2>"); |
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
// When I set up a json-specific transport... | |
$.ajaxTransport("json", function(options) { | |
console.log("json", options); | |
}); | |
// The json options are logged. | |
$.getJSON("/foo"); | |
// When I try to set up a catch-all transport... |
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
// Re. the LiveScript <-! operator (et al) | |
// http://gkz.github.com/LiveScript/ | |
function getLiveScriptOperator() { | |
var op = ''; | |
for (var i = 0; i < 3; i++) { | |
op += String.fromCharCode(33 + Math.floor(15 * Math.random())); | |
} | |
return op; | |
} |
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
# Please don't just RUN this. Do it step-by-step. | |
user=bocoup | |
orig_repo=training | |
new_repo=training-jquery | |
subdir=jquery-conference | |
# Pull down the original repo. | |
git clone [email protected]:$user/$orig_repo.git $new_repo | |
# Repo, I'm in you. |
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
[07:19] drug_motor ([email protected]) joined the channel. | |
[07:19] <drug_motor> ops plz | |
[07:19] ryan_opper sets mode +o drug_motor | |
[07:20] drug_motor kicked aguai from the channel. (aguai) | |
[07:20] drug_motor kicked Aikar from the channel. (Aikar) | |
[07:20] drug_motor kicked aka from the channel. (aka) | |
[07:20] drug_motor kicked AlbireoX from the channel. (AlbireoX) | |
[07:20] _root_ kicked drug_motor from the channel. (mass kick, go sit in a corner) | |
[07:20] Aikar (~Raxkar@wikia/Aikar) joined the channel. | |
[07:20] mattgifford ([email protected]) left IRC. (Remote host closed the connection) |
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 parent() { | |
var n = 0; | |
var spawn = require('child_process').spawn; | |
var child = spawn(process.execPath, [module.filename, true]); | |
child.stdout.on('data', function(buf) { | |
n += String(buf).length; | |
}); |
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 debounced = $.debounce(1000, orig); | |
var wrapper = function() { | |
// you have my permission to write whatever logic is useful to you here | |
if (arguments[0] === 'foo') { | |
orig.apply(null, arguments); | |
} else { | |
debounced.apply(null, arguments); | |
} | |
}; |