Skip to content

Instantly share code, notes, and snippets.

@rcubitto
Last active March 19, 2020 03:45
Show Gist options
  • Save rcubitto/8f0bf05a18d67ae18cb7d96730e4d8a6 to your computer and use it in GitHub Desktop.
Save rcubitto/8f0bf05a18d67ae18cb7d96730e4d8a6 to your computer and use it in GitHub Desktop.
Aliases
alias reload="source ~/.zshrc"
alias config="code ~/.zshrc"
# git
alias g="git"
alias gs="g status"
alias ga="g add"
alias gc="g commit -m"
alias gac="ga . && gc"
alias gb="g branch"
alias gbd="gb -d"
alias gbD="gb -D"
alias gco="g checkout"
alias gcob="gco -b"
alias gd="g diff"
alias gf="g fetch"
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
# show/hide hidden files in Finder
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
# laravel
alias a="php artisan"
alias at="php artisan tinker"
alias aclear="a view:clear && a debugbar:clear && cat /dev/null > storage/logs/laravel.log"
alias testing="a migrate --database=testing --seed"
alias amfs="a migrate:fresh --seed"
alias tailog="tail storage/logs/laravel.log"
# remove built js and css files by laravel mix, except the current one
mixclear() {
cd public/js
ls -t | tail -n +2 | xargs rm --
cd ../css
ls -t | tail -n +2 | xargs rm --
cd ../..
}
# phpunit
alias p="vendor/bin/phpunit"
alias pf="p --filter"
alias pg="p --group"
alias phpunit-report-runtime="vendor/bin/phpunit --log-json php://stdout \
| awk '\$NF ~ '/,/' && \$1 ~ /\"(test|time)\"/' \
| cut -d: -f2- \
| sed \"N;s/\n/--/\" \
| sed \"s/,//\" \
| awk 'BEGIN{FS=\"--\"}; {print \$2 \$1}' | sort -r \
| head -n 5"
# mysql
alias sql="mysql -uroot"
# re-create a database from the cli
sqlr () {
mysql -uroot -Bse "drop database $1; create database $1";
}
# npm
alias ns="npm start"
alias watch="npm run watch"
alias dev="npm run dev"
# misc
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy"
alias ll="$(brew --prefix coreutils)/libexec/gnubin/ls -ahlF --color --group-directories-first"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment