-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
145 lines (112 loc) · 4.37 KB
/
.bash_profile
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
# Add Git to Bash
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\e[38;5;32m\]___________________ |\[\e[0m\] \[\e[0;33m\]\w\[\e[0m\]\[\e[38;5;32m\] @ \u\[\e[0m\]\[\e[0;35m\]\$(parse_git_branch)\[\e[0m\]\[\e[38;5;32m\] \n$\[\e[0m\] "
export PS2="$ "
# Set Path
# ------------------------------------------------------------------
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH="$(brew --prefix php@7.1)/bin:$PATH"
# MAMP MySQL
# export PATH=$PATH:/Applications/MAMP/Library/bin/
# RBENV
# ------------------------------------------------------------------
export PATH="$HOME/.rbenv/shims:$PATH"
RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null;
then eval "$(rbenv init -)";
fi
eval "$(rbenv init -)"
# finderShowHidden: Show hidden files in Finder
# finderHideHidden: Hide hidden files in Finder
# -------------------------------------------------------------------
alias finderShowHidden='defaults write com.apple.finder AppleShowAllFiles YES'
alias finderHideHidden='defaults write com.apple.finder AppleShowAllFiles NO'
alias spacerTile="defaults write com.apple.dock persistent-apps -array-add '{'tile-type'='spacer-tile';}'"
# Git aliases
# -------------------------------------------------------------------
# write a commit message
function gc() {
git commit -m "$*"
}
# git add everything then commit
function gagc() {
git add .
git commit -m "$*"
}
# Opens the github page for the current git repo/branch in your browser
function gh() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]
then
echo "Not a git repository or no remote.origin.url set"
exit 1;
fi
giturl=${giturl/git\@github\.com\:/https://github.com/}
giturl=${giturl/\.git/\/tree/}
branch="$(git symbolic-ref HEAD 2>/dev/null)" ||
branch="(unnamed branch)" # detached HEAD
branch=${branch##refs/heads/}
giturl=$giturl$branch
open $giturl
}
# Hub
alias git=hub
# MAMP MySQL
alias mampMysql='/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot'
# Make and cd into directory
function mcd() {
mkdir -p "$1" && cd "$1";
}
# Clear Icon Cache
alias clearIconCache='sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; && sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;'
# Reset wifi
alias wifi='sudo ifconfig en0 down && sudo ifconfig en0 up'
# Check Local Weather
alias weather='curl -s http://wttr.in/Boston | head -7 | tail -5'
# Check Moon Phase
alias moon='curl -s http://wttr.in/Moon'
# Watch Star Wars
alias starWars='telnet towel.blinkenlights.nl'
# NPM
alias npmListGlobal='npm list -g --depth=0'
# Homebrew-cask
export HOMEBREW_CASK_OPTS='--appdir=/Applications'
# Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# Bash completions
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
# Open browser and submit PR for current branch against master
pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "...creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch?expand=1
}
# NVM
# source $(brew --prefix nvm)/nvm.sh
# if test "$(which brew)"; then
# NVM_INSTALL=$(brew --prefix nvm)
# if [ -d "$NVM_INSTALL" ]; then
# export NVM_DIR="$HOME/.nvm"
# . "$NVM_INSTALL/nvm.sh"
# fi
# fi
# Load .bashrc
source ~/.bashrc
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Ups Vagrant Autocomplete
uv () {
cd ~/Sites/uv/www/$1/wp-content/themes/$(echo $1 | cut -c 11-)
}
uv_complete() {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ls ~/Sites/uv/www/)" -- $cur) )
}
complete -F uv_complete uv