Skip to content

Instantly share code, notes, and snippets.

@bobbytables
Created April 6, 2014 18:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobbytables/10009543 to your computer and use it in GitHub Desktop.
Save bobbytables/10009543 to your computer and use it in GitHub Desktop.
alias ta="tmux attach-session -t"
alias tn="tmux new-session -s"
alias tl="tmux list-sessions"
alias tk="tmux kill-session -t"
export EDITOR=subl
source ~/.git-completion.sh
# Aliases!!
alias ls="ls -lsa"
alias start_pg="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start"
alias stop_pg="pg_ctl -D /usr/local/var/postgres stop -s -m fast"
alias start_redis="redis-server /usr/local/etc/redis.conf"
alias res="touch tmp/restart.txt"
alias start_mysql='mysql.server start'
alias stop_mysql='mysql.server stop'
alias start_es='elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.19.9/config/elasticsearch.yml'
alias fordev='foreman start -f Procfile.dev'
alias rake='bundle exec rake'
alias sidekiq='bundle exec sidekiq'
alias guard='bundle exec guard'
alias rspec='bundle exec rspec'
alias be='bundle exec'
alias start_cass='launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist'
alias ppjs='python -mjson.tool'
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
function parse_git_branch {
git_status="$(git status 2> /dev/null)"
branch_pattern="^On branch ([^${IFS}]*)"
state="${GREEN}"
if [[ ! ${git_status} =~ "working directory clean" ]]; then
state="${RED}"
fi
if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]}
echo " ${state}(${branch})"
fi
}
function prompt_func() {
git rev-parse --git-dir &> /dev/null
previous_return_value=$?
prompt="\u:\w${state}$(parse_git_branch)${COLOR_NONE} "
if [[ $previous_return_value == 0 ]]; then
PS1="${prompt}$ "
else
PS1=$PS1_DEFAULT
fi
}
PS1_DEFAULT=$PS1
PROMPT_COMMAND=prompt_func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment