Skip to content

Instantly share code, notes, and snippets.

@shrinkray
Created January 16, 2019 15:06
Show Gist options
  • Select an option

  • Save shrinkray/696ce48a4ae530d111c5fee80db93511 to your computer and use it in GitHub Desktop.

Select an option

Save shrinkray/696ce48a4ae530d111c5fee80db93511 to your computer and use it in GitHub Desktop.
Admittedly, this script has been added to, but not often edited. There are possibly a few things in here worth commenting out or removing altogether.
# source ~/.profile
# Set PATH vars
export PATH="/usr/local/bin:$PATH"
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.rbenv/bin:$PATH
# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
export PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:$PATH"
# Setting PATH for SublimeLinter
export PATH=/opt/bin:$PATH
# https://github.com/craigiswayne/craigiswayne.github.com/wiki/Mac-OSX---Install-Laravel-with-Homebrew
export PATH="~/.composer/vendor/bin:$PATH"
# yarn
export PATH="$PATH:`yarn global bin`"
# set sbin to PATH
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
# Terminal Prompt - See Evernote for explanation
export PATH="~/bin:$PATH"
# fix terminal bug
# export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# fix brew bug
export PATH=/usr/local/bin:$PATH
# setting php71 via CLI
# export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
PATH="/usr/local/sbin:$PATH"
# Not sure about this script
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
# Local OpenSSL
export PATH="/usr/local/opt/openssl/bin:$PATH"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
source $(brew --prefix)/etc/bash_completion
fi
# http://ezprompt.net/ 10/25/2018
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}
function nonzero_return() {
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "$RETVAL"
}
export PS1="\[\e[32m\]\d\[\e[m\] \[\e[34m\]\@\[\e[m\] \[\e[31m\]\u\[\e[m\]\[\e[31m\]@\[\e[m\]\[\e[31m\]\h\[\e[m\]: \[\e[36m\][\[\e[m\] \[\e[36m\]~/\[\e[m\]\[\e[36m\]\W\[\e[m\] \[\e[36m\]]\[\e[m\]: \[\e[37;45m\]\`nonzero_return\`\[\e[m\] \n$(if [[ $? == 0 ]]; then printf "\xf0\x9f\x98\x83"; else printf "\xf0\x9f\x98\x9c"; fi) \[\e[33m\]\`parse_git_branch\`\[\e[m\] $ "
# Returns
# Sat Oct 27 06:47 PM gmiller@gregmac: [ ~/sage-master ]:
# 😃 [master] $
# Some aliases for Homebrew
alias bup='brew update && brew upgrade'
alias bupc='brew update && brew upgrade --cleanup'
alias bout='brew outdated'
alias bin='brew install'
alias brm='brew uninstall'
alias bcl='brew cleanup'
alias bls='brew list'
alias bsr='brew search'
alias binf='brew info'
alias bdr='brew doctor'
alias bed='brew edit'
#Gulp
alias gw="gulp && gulp watch"
alias gp="gulp --production"
#more shortcuts
alias st="open -a /Applications/Sublime\ Text.app"
# CD Home
alias cdh="cd ~/."
# Inside a Flywheel site folder, loc jumps to the /themes/ location
alias loc="cd app/public/wp-content/themes/"
#================================================#
# Git
alias gpd="git push origin develop"
alias gpm="git push origin master"
alias gld="git pull origin develop"
alias glm="git pull origin master"
alias add="git add ."
alias com="git commit -m"
alias sta="git status -s"
alias gpum="git push upstream master"
alias gpud="git push upstream develop"
alias gptu="git push --tags upstream"
# GIT FUNCTIONS!!
# This has been a game changer for me. I absolutely love this.
# After typing comm put comment in double quotations like normal. and hit enter
# comm "Initial commit"
comm ()
{
git commit -m "$1"
}
# git add all, commit push -> Develop
acpd ()
{
git add . && git commit -m "$1" && git push origin develop
}
# git add files, commit message then push
acp ()
{
git add "$1" && git commit -m "$2" && git push origin develop
}
# Inkscape !! this is about the dumbest app I experimented with.
# alias ink="/usr/local/bin/inkscape"
#webpack
alias ww="npm run watch"
alias wp="npm run production"
# Tightlines Webpack
alias wmp="webpack --mode production"
alias wmd="webpack --mode development"
alias wwmd="webpack --watch --mode development"
#hosts run as administrator
# will ask for password
alias hosts="sudo code ../../etc/hosts"
#================================================#
# From gregmac root
alias cdjs='cd Sites/Flywheel/learn-js/app/public/'
alias fly='cd Sites/Flywheel/'
alias gm='cd Sites/Flywheel/gregmillerio/app/public/wp-content/'
# Open Broader list of courses in VSCode
alias learnjs="code Sites/Flywheel/learn-js/app/public"
# I have several courses I work on from time to time. Each are a folder in a root directory that is a Flywheel instance called learn-js
# Open Mead JS Course in VSCode
alias meadjs="code Modern-Javascript/"
alias meadql="code Graph-QL/"
alias meadno="code NodeJS"
alias grid="code css-grid/"
alias wb30="code wbjs30/"
alias wbno="code wb-NodeJS"
alias wbre="code wb-ReactJS"
#================================================#
# Call Bash? These are for my bash files, either to open in VSCode or or run source command to use after changing.
alias bar='code ~/.bashrc' # This file
alias bap='code ~/.bash_profile' # Path bash
alias sbar='source ~/.bashrc'
alias sbap='source ~/.bash_profile'
#================================================#
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#================================================#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment