This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmhsrc
executable file
·199 lines (179 loc) · 4.69 KB
/
mhsrc
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/usr/bin/env bash
# Colors
BLACK='\[\e[0;30m\]'
BLUE='\[\e[0;34m\]'
GREEN='\[\e[0;32m\]'
CYAN='\[\e[0;36m\]'
RED='\[\e[0;31m\]'
PURPLE='\[\e[0;35m\]'
BROWN='\[\e[0;33m\]'
LIGHTGRAY='\[\e[0;37m\]'
DARKGRAY='\[\e[1;30m\]'
LIGHTBLUE='\[\e[1;34m\]'
LIGHTGREEN='\[\e[1;32m\]'
LIGHTCYAN='\[\e[1;36m\]'
LIGHTRED='\[\e[1;31m\]'
LIGHTPURPLE='\[\e[1;35m\]'
YELLOW='\[\e[1;33m\]'
WHITE='\[\e[1;37m\]'
NC='\[\033[00m\]' #'\e[0m' # No Color
# Flush DNS Cache
alias fcache='dscacheutil -flushcache'
# TextMate
alias m='mate'
# Sublime Text 2
alias subl="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
# Rails
function ss {
if [ -e Procfile ]; then
foreman start
elif [ -e script/rails ]; then
script/rails server $@
else
script/server $@
fi
}
function ssd {
if [ -e script/rails ]; then
script/rails server --debugger $@
else
script/server --debugger $@
fi
}
function sc {
if which pry >/dev/null; then
pry -r ./config/environment
elif [ -e script/rails ]; then
script/rails console $@
else
script/console $@
fi
}
function sg {
if [ -e script/rails ]; then
script/rails generate $@
else
script/generate $@
fi
}
function sr {
if [ -e script/rails ]; then
script/rails runner $@
else
script/runner $@
fi
}
function sd {
if [ -e script/rails ]; then
script/rails destroy $@
else
script/destroy $@
fi
}
function sp {
if [ -e script/rails ]; then
script/rails plugin $@
else
script/plugin $@
fi
}
alias be='bundle exec'
alias ber='be rake'
alias bert='ber -T'
alias bec='be cucumber'
alias r='touch tmp/restart.txt'
alias tmig="rake db:migrate && rake db:rollback && rake db:migrate && rake db:test:prepare"
alias mycucumber='script/cucumber --require features/support/env.rb --require features/step_definitions/ --require features/support/'
function cuw {
if [ $# -eq 0 ]; then
script/cucumber -p default features/webrat
else
script/cucumber -p default $@
fi
}
function cus {
if [ $# -eq 0 ]; then
script/cucumber -pselenium features/selenium
else
script/cucumber -pselenium $@
fi
}
# Awk
alias first="awk '{ print \$1 }'"
alias second="awk '{ print \$2 }'"
alias third="awk '{ print \$3 }'"
alias fourth="awk '{ print \$4 }'"
alias fifth="awk '{ print \$5 }'"
alias sixth="awk '{ print \$6 }'"
alias seventh="awk '{ print \$7 }'"
alias eighth="awk '{ print \$8 }'"
alias ninth="awk '{ print \$9 }'"
alias tenth="awk '{ print \$10 }'"
###############################################################
# Git Configs and Helper Functions
###############################################################
# == Shared Git Config
# To get the latest shared .gitconfig run:
# ~/.tidbits/bin/tidbits_update_gitconfig
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
__git_ps1 () {
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf " (%s)" "${b##refs/heads/}";
fi
}
function gittrack {
git checkout -b $1 origin/$1
}
# usage: gitpub <branch_name>
# ex: gitpub foo
#
# Pushes a local branch to the remote origin
# and sets up the local branch as a remote
# tracking one with the correct remote
# and merge settings.
function gitpub {
git push origin $1\:refs/heads/$1
git fetch origin
git config branch.$1.remote origin
git config branch.$1.merge refs/heads/$1
git checkout $1
}
alias gitamend='git ci --amend -C HEAD'
alias gitmod='git status | grep "modified:" | third'
alias gitdel='git status | grep "deleted:"'
alias gits='git status'
alias gitbr='git branch'
alias giton='git checkout '
alias gitake='git checkout -b'
alias gitsup='git svn rebase'
alias gitlog='git log --name-status'
alias gitundo='git rm -f --cached'
alias gitlogst='git log --stat'
alias cmp_origin_to_master='git log origin/master..master'
alias cmp_master_to_origin='git log master..origin/master'
alias cmp_head_to_master='git log HEAD..master'
alias cmp_master_to_head='git log master..HEAD'
# ad is for *alias directory*. It creates persistent
# aliases.
function ad
{
~/.tidbits/lib/aliasdir.rb $@
eval `~/.tidbits/lib/aliasdir.rb --dump`
}
eval `~/.tidbits/lib/aliasdir.rb --dump`
# FF 3.5.x doesn't play nice with SQLite3 on Mac OS X 10.6, a.k.a., Snow Leopard.
# Replace the FF 3.5.x libsqlite3.dylib with the system one.
#
# NOTE: you must do this after ever FF 3.5.x update.
#
# See:
# http://support.mozilla.com/tiki-view_forum_thread.php?locale=it&forumId=1&comments_parentId=449775
function ff35_sqlite3
{
mv /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib.orig
cp /usr/lib/libsqlite3.dylib /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib
}
PATH=$PATH:$(pwd)/.tidbits/bin