Skip to content

Instantly share code, notes, and snippets.

@jgdavey
jgdavey / gist:1685824
Created January 26, 2012 23:28
Harvest your git messages
#!/usr/bin/env ruby
# Adapted from https://gist.github.com/946311
#
# To use, put something like the following in your .bashrc.local:
#
# alias harvest='rvm use 1.9.2@harvester;harvester;cd ..;cd -'
author = `git config --global user.name`.chomp
@jgdavey
jgdavey / _hitch.sh
Created October 2, 2011 17:51
Hitch author completion
#compdef hitch
__hitch_authors() {
local expl
local -a _authors
if [ -f $HOME/.hitch_pairs ]; then
_authors=(${${(f)"$(cat $HOME/.hitch_pairs | awk '/:/ { print }')"}/:[ $'\t']##/:})
fi
_describe -t hitch-authors 'hitch authors' _authors "$@"
}
function! s:ToggleDoEndOrBrackets()
let char = getline('.')[col('.')-1]
if char =~ '[{}]'
if char=='}'
norm %
endif
norm h
" Bracket touching previous word
if getline('.')[col('.')-1] =~ '[^ ;]'
exe "norm! a "
def self.up
if connection.tables.include?('posts')
drop_table :posts
end
end
@jgdavey
jgdavey / rvm_gem_migrate.sh
Created January 4, 2010 20:01
rvm gem migration
# Switch back to system just to make sure
rvm use system
# Print a list of all gems installed on the system
gem list | awk '{print $1}' > gems.txt
# Switch to the new version of ruby
rvm use ree
# Install each gem from the list, skipping documentation