timriley (owner)

Revisions

gist: 122735 Download_button fork
public
Public Clone URL: git://gist.github.com/122735.git
Embed All Files: show embed
.bash_profile.sh #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
 
# Colors
 
# 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 HISTSIZE="2000"
export HISTIGNORE="&:ls:[bf]g:exit"
 
export TM_RUBY="/opt/local/bin/ruby"
 
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 ../..'
 
# 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
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 gpom='git pull 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 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
}