Skip to content

Instantly share code, notes, and snippets.

@danieldevine
Last active January 15, 2021 14:28
Show Gist options
  • Select an option

  • Save danieldevine/b10321b86c172152947368253316a728 to your computer and use it in GitHub Desktop.

Select an option

Save danieldevine/b10321b86c172152947368253316a728 to your computer and use it in GitHub Desktop.
#########
# Colours
#########
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFha'
#########
# Aliases
#########
#saves wear on / key
alias www='cd ~/Sites'
#edit the hosts file
alias hosts='sudo code /etc/hosts'
#too lazy to type git
alias push='git push'
alias pull='git pull'
#web shortcuts (examples)
alias bitbucket='open https://bitbucket.org'
alias drive='open https://drive.google.com/drive/my-drive'
#laravel
alias art='php artisan'
alias artisan='php artisan'
#npm
alias witch='npm run watch'
alias serf='npm run serve'
alias prod='npm run production'
#open this file
alias bosh='code ~/.bash_profile'
###########
# Functions
###########
#open default web browser and point to url specified
web() { open https://"$1"; }
#open bitbucket at named repository
bbuck() { open https://bitbucket.org/<your-org>/"$1"; }
#go to directory of given project
grobe() { cd ~/Sites/"$1"; }
#go to www directory and open in vscode :)
co() {
cd ~/Sites/"$1"
code .
}
jump() {
cd ~/Sites/"$1"
code .
npm run watch
}
#git add and commit while sparing fingers and keyboard.
gurt() { git add --all && git commit -m "$*"; }
#adds wp page with multi word titles enabled
wppage() { wp post create --post_type=page --post_title="$@"; }
#adds wp custom post type. Add args like 'custom post type name' then 'custom post type title'
wpcreate() { wp post create --post_type="$1" --post_title="${@:2}"; }
#see who's contributed the most to a project :)
whodid() { git log --shortstat --author "$1" --since "100 weeks ago" --until "today" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'; }
#put composer on the path, mostly for laravel
export PATH="$PATH:$HOME/.composer/vendor/bin"
#adds tab completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
#display current git branch in terminal
parse_git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# remove annoying zsh nag
export BASH_SILENCE_DEPRECATION_WARNING=1
#mjml
export PATH="$PATH:./node_modules/.bin"
alias composer="php /usr/local/bin/composer.phar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment