Skip to content

Instantly share code, notes, and snippets.

@danmartens
Created May 10, 2016 03:18
Show Gist options
  • Save danmartens/aefcfd35f477c27ae366962ab729d21e to your computer and use it in GitHub Desktop.
Save danmartens/aefcfd35f477c27ae366962ab729d21e to your computer and use it in GitHub Desktop.
alias rc='bin/rails console'
alias rdbc='bin/rails dbconsole'
alias rg='bin/rails generate'
alias rgm='bin/rails generate migration'
alias rgc='bin/rails generate controller'
alias rs='bin/rails server'
alias rcc='bin/rails runner Rails.cache.clear'
alias devlog='tail -f log/development.log'
alias rdbm='bin/rake db:migrate'
alias rdbms='bin/rake db:migrate:status'
alias rdbmt='RAILS_ENV=test bin/rake db:migrate'
alias rdbr='bin/rake db:rollback'
alias ms='bundle exec middleman server'
alias mb='bundle exec middleman build'
alias fr='bundle exec foreman run'
alias http='python -m SimpleHTTPServer'
alias hr='heroku run'
alias hrdbm='heroku run rake db:migrate'
# Heroku Console
hrc() {
if (( $# == 0 )); then
heroku run console;
else
heroku run console --app $1;
fi
}
# Rails Routes
rr() {
if (( $# == 0 )); then
bin/rake routes;
else
bin/rake routes | grep $1;
fi
}
rdbmd() { bin/rake db:migrate:down VERSION=$*; }
echo_purple() { echo -e '\x1B[30;45m'"\n\033[1m $1 \033[0m\n" }
# CD to Project
c() { cd ~/Projects/$1; }
_c() { _files -W ~/Projects -/; }
compdef _c c
alias c='nocorrect c'
# Open Sublime
s() {
if (( $# == 0 )); then
subl .;
else
subl ~/Projects/$1;
fi
}
_s() { _files -W ~/Projects -/; }
compdef _s s
alias s='nocorrect s'
# Foreman Start
fs() {
if (( $# == 1 )); then
cd ~/Projects/$1;
fi
if ls 'Procfile.local' &> /dev/null; then
local procfile='Procfile.local'
echo_purple "Starting foreman with Procfile.local...";
else
local procfile='Procfile'
echo_purple "Starting foreman with Procfile...";
fi
foreman start -f $procfile;
}
_fs() { _files -W ~/Projects -/; }
compdef _fs fs
alias fs='nocorrect fs'
killport() { kill -9 $(lsof -i tcp:$1 -Fp | tr -d p); }
up() { DEEP=$1; [ -z "${DEEP}" ] && { DEEP=1; }; for i in $(seq 1 ${DEEP}); do cd ../; done; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment