Skip to content

Instantly share code, notes, and snippets.

@chrismealy
chrismealy / rename-db.sh
Created January 24, 2012 21:49 — forked from michaelmior/rename-db.sh
Simple script to move all tables from one database to another. Please don't use this in product as could fail horribly. Also, RENAME table doesn't work on views, so they won't be migrated.
#!/bin/sh
OLD_DB=$1
NEW_DB=$2
TABLES=`echo "SHOW TABLES IN $1;" | mysql -NB`
IFS="
"
@chrismealy
chrismealy / Procfile
Created January 23, 2012 21:35 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
@chrismealy
chrismealy / zipper.rb
Created December 19, 2011 17:00 — forked from yhara/zipper.rb
Ruby implementation of Zipper (and its spec)
#
# Zipper has @left and @right.
# When a zipper represents [1, 2, 3, <cursor>, 4, 5],
# @left == [3, [2, [1, []]]], @right == [4, [5, []]]
# Note that @left is in reverse order.
#
class Zipper
include Enumerable
def self.make(*vals)
@chrismealy
chrismealy / zipper.rb
Created December 19, 2011 17:00 — forked from yhara/zipper.rb
Ruby implementation of Zipper (and its spec)
#
# Zipper has @left and @right.
# When a zipper represents [1, 2, 3, <cursor>, 4, 5],
# @left == [3, [2, [1, []]]], @right == [4, [5, []]]
# Note that @left is in reverse order.
#
class Zipper
include Enumerable
def self.make(*vals)