-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new mac setup script and supporting config files
- Loading branch information
0 parents
commit 9499f68
Showing
9 changed files
with
2,576 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
#################### | ||
# PATH # | ||
#################### | ||
|
||
# make rbenv actually work | ||
export PATH="$HOME/.rbenv/bin:$PATH" | ||
eval "$(rbenv init -)" | ||
|
||
# make golang work | ||
export GOPATH=$HOME/go | ||
export PATH=$PATH:$GOPATH/bin | ||
|
||
|
||
#################### | ||
# MISC # | ||
#################### | ||
|
||
# default editor | ||
export EDITOR=vim | ||
|
||
|
||
# FZF keybindings | ||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash | ||
|
||
# don't send analytics to homebrew | ||
export HOMEBREW_NO_ANALYTICS=1 | ||
|
||
# make Shopify devtools work | ||
if [[ -f /opt/dev/dev.sh ]]; then source /opt/dev/dev.sh; fi | ||
|
||
#################### | ||
# APPEARANCE # | ||
#################### | ||
|
||
# pretty prompt | ||
ORANGE=$(tput setaf 9) | ||
VIOLET=$(tput setaf 13) | ||
CYAN=$(tput setaf 6) | ||
RESET=$(tput sgr0) | ||
export PS1='\[$VIOLET\]{\@}\[$CYAN\]{\w\[$ORANGE\]$(__git_ps1)\[$CYAN\]} $ \[$RESET\]' | ||
export PS2="${COLOR}\[\@\] > ${RESET}" | ||
|
||
# cool prompt currently not working correctly | ||
# export PS1='\[$VIOLET\]{💻 \h} \[$CYAN\]{🕒 \@} {📂 \w\[$ORANGE\]$(__git_ps1)\[$CYAN\]} $ \[$RESET\]' | ||
|
||
# export GIT_PS1_SHOWDIRTYSTATE=1 | ||
source ~/git-completion.bash # completion | ||
source ~/git-prompt.sh # prompt | ||
|
||
# tab completion | ||
bind "set completion-ignore-case on" | ||
bind "set show-all-if-ambiguous on" | ||
|
||
#################### | ||
# ALIASES # | ||
#################### | ||
|
||
## navigating | ||
alias ls='ls -Gh' | ||
alias ll='ls -Glha' | ||
alias dropb='cd ~/Dropbox' | ||
alias tree='tree -C -L 3' | ||
alias bashp='vim ~/.bash_profile' | ||
alias code='cd ~/Code' | ||
alias sob='source ~/.bash_profile' | ||
|
||
## vim | ||
alias vimsp='vim $1 +sp $2 +n' | ||
alias vimvsp='vim $1 +vsp $2 +n' | ||
alias vimrc='vim ~/.vimrc' | ||
|
||
## git | ||
alias gst='git status' | ||
alias gcm='git checkout master' | ||
alias gpull='git pull && ctags -R --languages=ruby,javascript --exclude=.git --exclude=log .' | ||
alias gcmp='gcm && gpull' | ||
alias grb='git_rebase_latest_master' | ||
alias gup='git_upstream_push_and_launch_pr_in_browser' | ||
alias gconf='git diff --name-only --diff-filter=U' # view all merge conflicts | ||
alias glog='git_pretty_log $1' | ||
alias gdiff='git_diff_since' | ||
|
||
alias goops='git checkout -- $1' | ||
alias gdang='git_dangling_commits_tree' # view lost commits and stashes | ||
alias gdamn='git commit --amend --no-edit' | ||
alias gshit='git_interactive_rebase_x_commits_ago $1' | ||
alias gfuck='git_commit_amend_all_and_force_push' | ||
|
||
## shopify | ||
#alias oo='dev cd shopify' | ||
#alias ii='dev cd shipify' | ||
#alias ddu='dev down && dev up' | ||
#alias ddd='dev down && dev up && dev server' | ||
#alias killpuma='pgrep -f puma | xargs kill -9' | ||
|
||
################### | ||
# FUNCTIONS # | ||
################### | ||
|
||
# rename current terminal tab | ||
function title { echo -ne "\033]0;"$*"\007"; } | ||
|
||
# display a tree of all dangling commits | ||
function git_dangling_commits_tree { | ||
git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' ); | ||
} | ||
|
||
# force push all changes on top of previous commit | ||
function git_commit_amend_all_and_force_push { | ||
if [ "$(git symbolic-ref --short HEAD)" != "master" ] ; then git commit -a --amend --no-edit && git push -f; fi; | ||
} | ||
|
||
# update to latest master and rebase current branch on top of it | ||
function git_rebase_latest_master { | ||
gstatus=$(git status --porcelain) && \ | ||
if [ "$gstatus" != "" ] ; then git stash --include-untracked ; fi && \ | ||
git fetch origin master:master && \ | ||
git rebase master && \ | ||
if [ "$gstatus" != "" ] ; then git stash pop ; fi; | ||
} | ||
|
||
# push to new upstream branch with same name as local branch, then open default browser to Github page for new branch | ||
function git_upstream_push_and_launch_pr_in_browser { | ||
cd $(git rev-parse --show-toplevel) && \ | ||
git push --set-upstream origin $(git symbolic-ref --short HEAD) && \ | ||
open "https://github.com/Shopify/$(basename "$PWD")"; | ||
} | ||
|
||
function git_interactive_rebase_x_commits_ago { | ||
if [[ $1 =~ ^[0-9]+$ ]] ; then git rebase -i HEAD~$1 ; fi; | ||
} | ||
|
||
function git_pretty_log { | ||
if [[ $1 =~ ^[0-9]+$ ]] ; then | ||
git log -$1 --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit | ||
else | ||
git log -20 --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit | ||
fi | ||
} | ||
|
||
function git_diff_since { | ||
if [[ $1 =~ ^[0-9]+$ ]] ; then | ||
git diff -w HEAD~$1 | ||
else | ||
git diff -w | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Vim files # | ||
**/*~ | ||
**/*.bak | ||
**/*.sw[abcdefghijklmnop] | ||
|
||
# Invoker gem | ||
invoker.ini | ||
|
||
# CTags | ||
tags | ||
|
||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
|
||
# Packages # | ||
############ | ||
# it's better to unpack these files and commit the raw source | ||
# git has its own built in compression methods | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.sql | ||
*.sqlite | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"maxerr" : 50, // {int} Maximum error before stopping | ||
|
||
// Enforcing | ||
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) | ||
"curly" : true, // true: Require {} for every new block or scope | ||
"eqeqeq" : true, // true: Require triple equals (===) for comparison | ||
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() | ||
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. | ||
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` | ||
"latedef" : false, // true: Require variables/functions to be defined before being used | ||
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()` | ||
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` | ||
"noempty" : true, // true: Prohibit use of empty blocks | ||
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. | ||
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) | ||
"plusplus" : false, // true: Prohibit use of `++` and `--` | ||
"quotmark" : false, // Quotation mark consistency: | ||
// false : do nothing (default) | ||
// true : ensure whatever is used is consistent | ||
// "single" : require single quotes | ||
// "double" : require double quotes | ||
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) | ||
"unused" : true, // Unused variables: | ||
// true : all variables, last function parameter | ||
// "vars" : all variables only | ||
// "strict" : all variables, all function parameters | ||
"strict" : true, // true: Requires all functions run in ES5 Strict Mode | ||
"maxparams" : false, // {int} Max number of formal params allowed per function | ||
"maxdepth" : false, // {int} Max depth of nested blocks (within functions) | ||
"maxstatements" : false, // {int} Max number statements per function | ||
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function | ||
"maxlen" : false, // {int} Max number of characters per line | ||
"varstmt" : false, // true: Disallow any var statements. Only `let` and `const` are allowed. | ||
|
||
// Relaxing | ||
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) | ||
"boss" : false, // true: Tolerate assignments where comparisons would be expected | ||
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints. | ||
"eqnull" : false, // true: Tolerate use of `== null` | ||
"esversion" : 6, // {int} Specify the ECMAScript version to which the code must adhere. | ||
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) | ||
// (ex: `for each`, multiple try/catch, function expression…) | ||
"evil" : false, // true: Tolerate use of `eval` and `new Function()` | ||
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs | ||
"funcscope" : false, // true: Tolerate defining variables inside control statements | ||
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') | ||
"iterator" : false, // true: Tolerate using the `__iterator__` property | ||
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block | ||
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings | ||
"laxcomma" : false, // true: Tolerate comma-first style coding | ||
"loopfunc" : false, // true: Tolerate functions being defined in loops | ||
"multistr" : false, // true: Tolerate multi-line strings | ||
"noyield" : false, // true: Tolerate generator functions with no yield statement in them. | ||
"notypeof" : false, // true: Tolerate invalid typeof operator values | ||
"proto" : false, // true: Tolerate using the `__proto__` property | ||
"scripturl" : false, // true: Tolerate script-targeted URLs | ||
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` | ||
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation | ||
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` | ||
"validthis" : false, // true: Tolerate using this in a non-constructor function | ||
|
||
// Environments | ||
"browser" : true, // Web Browser (window, document, etc) | ||
"browserify" : false, // Browserify (node.js code in the browser) | ||
"couch" : false, // CouchDB | ||
"devel" : false, // Development/debugging (alert, confirm, etc) | ||
"dojo" : false, // Dojo Toolkit | ||
"jasmine" : false, // Jasmine | ||
"jquery" : true, // jQuery | ||
"mocha" : true, // Mocha | ||
"mootools" : false, // MooTools | ||
"node" : true, // Node.js | ||
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc) | ||
"phantom" : false, // PhantomJS | ||
"prototypejs" : false, // Prototype and Scriptaculous | ||
"qunit" : false, // QUnit | ||
"rhino" : false, // Rhino | ||
"shelljs" : false, // ShellJS | ||
"typed" : false, // Globals for typed array constructions | ||
"worker" : false, // Web Workers | ||
"wsh" : false, // Windows Scripting Host | ||
"yui" : false, // Yahoo User Interface | ||
|
||
// Custom Globals | ||
"globals" : {} // additional predefined global variables | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Style/DocumentationMethod: false |
Oops, something went wrong.