Skip to content

Instantly share code, notes, and snippets.

@chrismealy
chrismealy / konami.js
Created February 21, 2012 18:10
easter egg
$(document).ready(function() {
var easterEgg = 'egg';
var eggLength = easterEgg.length;
var keyHistory = '';
var match;
$(document).keypress(function(e) {
keyHistory += String.fromCharCode(e.which)
match = keyHistory.match(easterEgg);
if(match) {
@chrismealy
chrismealy / gist:1861354
Created February 18, 2012 23:54
shell colors
function colours() {
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
}
@chrismealy
chrismealy / file1.sh
Created February 16, 2012 22:53 — forked from rojotek/file1.sh
Ruby with OpenSSL on OSX 10.7
rvm pkg install openssl
rvm remove 1.9.3
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr --with-gcc=clang
@chrismealy
chrismealy / notes.rb
Created February 13, 2012 05:41
rails backup
#
# Backup
# Generated Template
#
# For more information:
#
# View the Git repository at https://github.com/meskyanichi/backup
# View the Wiki/Documentation at https://github.com/meskyanichi/backup/wiki
# View the issue log at https://github.com/meskyanichi/backup/issues
#
@chrismealy
chrismealy / Ubuntu rbenv
Created February 13, 2012 01:00
Installing Ruby 1.9.2 with OpenSSL on Ubuntu 11.04 using ruby-build and rbenv
# for more info: https://gist.github.com/1120938
@chrismealy
chrismealy / rbenv-install-system-wide.sh
Created February 13, 2012 00:06
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@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)