Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
drewlesueur / sync_forked.md
Created April 17, 2011 04:28
How to sync your forked branch

This is how I synced my forked underscore.js repo with the original repo
From your forked repo:

git checkout -b upstream/master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master                          // [my master branch]
git merge upstream/master (git rebase upstream/master ????)
git push origin master
$('.vidstack').click(function(){
$(iframe).attr('src',$(this).attr("data-url"));
})
@drewlesueur
drewlesueur / how_to_use_screen.md
Created May 1, 2011 02:26
How to use linux screen
@drewlesueur
drewlesueur / gist:997368
Created May 29, 2011 00:53
async.js forEach vs forEachSeries
exports['forEachSeries'] = function(test){
var args = [];
async.forEachSeries([1,3,2], function(x, callback){
setTimeout(function(){
args.push(x);
callback();
}, x*25);
}, function(err){
test.same(args, [1,3,2]);
test.done();
@drewlesueur
drewlesueur / lastingConnection.coffee
Created June 11, 2011 02:45
node mysql lasting connection
# How to make a lasting connection in node mysql
client = null
db = null
tries = 0
makeLastingConnection = =>
tries++
client = new Client
client.host = config.db.host
@drewlesueur
drewlesueur / err.py
Created June 17, 2011 16:44
Older python exception handling
def foo():
raise "error!!"
try:
foo()
except Exception, strerror:
print strerror
@drewlesueur
drewlesueur / test.js
Created July 1, 2011 14:05
windows script host
WScript.Echo("Hello world");
// var send = WScript.CreateObject("System.Windows.Forms.SendKeys");
// send.Send("{PRTSC}");
voice = WScript.CreateObject("SAPI.SpVoice");
voice.Speak("Hello world");
http://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.85).aspx
@drewlesueur
drewlesueur / delete_files.sh
Created July 6, 2011 16:51
looping thru a file in bash
#Finding and removing files
for line in `cat invoices`; do find . -name "*$line*" | xargs rm -f ; done
for line in `cat invoices`; do ruby my_ruby_file $line; done
sed -i "s/<\/invoice_id>/A<\/invoice_id>/g" *
@drewlesueur
drewlesueur / module.js
Created July 29, 2011 05:11 — forked from creationix/module.js
A super simple module system for browsers. Assumes all source files are concatenated and in browser.
var defs = {};
var modules = {};
function define(name, fn) {
defs[name] = fn;
}
function require(name) {
//console.log("Loading " + name);
if (modules.hasOwnProperty(name)) return modules[name];
if (defs.hasOwnProperty(name)) {
var fn = defs[name];