-
-
Save glennr/218795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### RAILS SHORTCUT GLORY | |
# | |
# printf "\033[0m0 All attributes off\033[0m\n" | |
# printf "\033[1m1 Bold\033[0m\n" | |
# printf "\033[4m4 Underline\033[0m\n" | |
# printf "\033[5m5 Blink\033[0m\n" | |
# printf "\033[7m7 Invert\033[0m\n" | |
# printf "\033[8m8 Hide\033[0m8 = Hide\n" | |
# printf "\033[30m30 Black\033[0m30 = Black\n" | |
# printf "\033[31m31 Red\033[0m\n" | |
# printf "\033[32m32 Green\033[0m\n" | |
# printf "\033[33m33 Yellow\033[0m\n" | |
# printf "\033[34m34 Blue\033[0m\n" | |
# printf "\033[35m35 Magenta\033[0m\n" | |
# printf "\033[36m36 Cyan\033[0m\n" | |
# printf "\033[37m37 White\033[0m\n" | |
# printf "\033[40m\033[37m40 Black Background\033[0m\n" | |
# printf "\033[41m41 Read Background\033[0m\n" | |
# printf "\033[42m42 Green Background\033[0m\n" | |
# printf "\033[43m43 Yellow Background\033[0m\n" | |
# printf "\033[44m44 Blue Background\033[0m\n" | |
# printf "\033[45m45 Magenta Background\033[0m\n" | |
# printf "\033[46m46 Cyan Background\033[0m\n" | |
# printf "\033[47m47 White Background\033[0m\n" | |
export TM_RUBY="/opt/local/bin/ruby" | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
fi | |
export PS1='\[\033[0;32m\]\h\[\033[0;34m\] \w$ ' | |
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# http://gist.github.com/47546 | |
function parse_git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[[ $? == 1 ]] && echo "*" | |
} | |
function parse_git_branch { | |
local branch=$(__git_ps1 "%s") | |
[[ $branch ]] && echo "[$branch$(parse_git_dirty)]" | |
} | |
export PS1=$(echo "$PS1" | sed 's/\\w/\\w\\[\\033[35m\\]$(parse_git_branch)\\[\\033[0m\\]/g') | |
function manpdf() { | |
man -t $@ | open -f -a /Applications/Preview.app/ | |
} | |
# General | |
alias l='ls -lah' | |
alias h='history' | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
#alias diff='/opt/local/libexec/git-core/git-diff' | |
export EDITOR=vim | |
# TextMate | |
alias m='mate' | |
alias mr='mate README TODO app/ config/ db/ doc/ lib/ public/javascripts public/stylesheets test/ spec/ features/ stories/ vendor/plugins' | |
### GIT | |
# | |
### Dont forget to set up Git autocompletion first: | |
# http://blog.ericgoodwin.com/2008/4/10/auto-completion-with-git | |
source ~/.git-completion.bash | |
### | |
alias gs='git status' | |
alias gca='git commit -a -m' | |
alias gcm='git commit -m' | |
alias gb='git branch' | |
alias gd='git diff' | |
alias gp='git pull' | |
alias gplom='git pull origin master' | |
alias gpom='git push origin master' | |
# gc => git checkout master | |
# gc bugs => git checkout bugs | |
function gc { | |
if [ -z "$1" ]; then | |
git checkout master | |
else | |
git checkout $1 | |
fi | |
} | |
# SVN | |
alias sup='svn up' | |
alias sst='svn st' | |
alias sstu='svn st -u' | |
alias sci='svn commit' | |
alias sdi='svn diff' | |
alias svnclear='find . -name .svn -print0 | xargs -0 rm -rf' | |
alias svnaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add' | |
# Ruby | |
alias irb='irb --readline -r irb/completion -rubygems' | |
function cdgem { | |
cd /opt/local/lib/ruby/gems/1.8/gems/; cd `ls|grep $1|sort|tail -1` | |
} | |
# Rails | |
alias r='touch tmp/restart.txt' | |
alias ss='script/server' | |
# alias sc='script/console' | |
alias sd='script/dbconsole' | |
alias gen='script/generate' | |
alias a='autotest -rails' | |
alias dbm='rake db:migrate' | |
alias dbm0='rake db:migrate VERSION=0' | |
alias dbi='rake db:initialize' | |
alias dbp='rake db:populate' | |
alias dbtp='rake db:test:prepare' | |
alias dbda='rake db:drop:all' | |
alias dbca='rake db:create:all' | |
alias dbcycle='dbda && dbca && dbm; dbi; dbp; dbtp' | |
function sc { | |
if [ -x script/console ]; then | |
script/console | |
else | |
sinatra_rb=`egrep -l "^require.+sinatra.$" *.rb 2>/dev/null` | |
if [ -e $sinatra_rb ]; then | |
irb -r $sinatra_rb | |
else | |
irb | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment