Skip to content

Instantly share code, notes, and snippets.

View michaeltwofish's full-sized avatar

Michael C. Harris michaeltwofish

  • South Australia, Australia
View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jeffreyiacono
jeffreyiacono / dev_to_prod.js
Created September 20, 2011 07:37
(budget) find / replace for mongodb
// For a collection "things" that has multiple documents of the form:
// { "_id" : ObjectId("4e5c47d1b0207a1ad3000001"),
// "filename" : "uploads/development/user/4dbf2b0ab0207a2e8a000001/avatar/avatar.png",
// "other_data" : "foo"
// }, etc.
// we want to replace "development" in "filename" with "production".
// Run via mongo shell:
db.things.find().forEach(function(e) {
var parts = e.filename.split('development');
e.filename = parts[0] + 'production' + parts[1];
@jberkel
jberkel / gist:98765
Created April 20, 2009 21:16
support for editors in irb
# .irbrc
# vim: set syntax=ruby :
require 'irb/completion'
require 'irb/ext/save-history'
require 'fileutils'
require 'pp'
require 'rubygems'
ARGV.concat [ "--readline",
"--prompt-mode",