Skip to content

Instantly share code, notes, and snippets.

View mwitek's full-sized avatar

Matt Witek mwitek

View GitHub Profile

ES6 cheat sheet, with very tasty examples

Declarations

let - prevents javascript hoisting to top of document, variables are scoped to function (no more undefined error when trying to call a var outside a functions scope, you get a ReferenceError which is more predictable/expected).

const - provides constants, cannot be redefined, raises syntax error

Function Arguments

####################
# Dir colors (barwin custom)
# http://www.mactips.org/archives/2005/08/02/color-your-os-x-command-prompt/
# http://www.macosxhints.com/article.php?story=20031025162727485
export CLICOLOR=1
#export LSCOLORS=fxFxCxDxBxegedabagacad
export LSCOLORS=fxExcxdxbxegedabagacad
###################
##### /LS_COLOR #####
1314037941|jessemgarrison|should be HTMLDore
1314037953|jessemgarrison|HTML Team
1322774320|thryn.albin|GryFEDore
1322872082|thryn.albin|GryFEDor
1337201319|j0ntanner|GryFEDor (Youtube / Kittens/ Unicorns)
1337238157|jessemgarrison|GryFEDor (Youtube / Kittens / Unicorns)
1337238355|jessemgarrison|GryFEDor (Youtube / Kittens / Unicorns / Stars / Double Rainbows)
1337811657|thryn.albin|GryFEDor (only serious business)
1337811675|thryn.albin|GryFEDor (only serious business at least until next week)
1338002473|j0ntanner|GryFEDor (FUN TIMES)
@mwitek
mwitek / ruby_benchmark_test.rb
Created April 1, 2013 04:17
Benchmark test for passing a method to another vs just using an array and each
require 'benchmark'
repetitions = 1000000
def assert_method(string)
string.kind_of?(String)
end
def assert_form_with_fields(assertion)
@mwitek
mwitek / MAMP_silent_start
Created August 11, 2012 18:15
Shell functions to run mamp from terminal
#function to run mamp from terminal. Below are the instructions...
# Step 1. In terminal type: open ~/.bash_profile
# Step 2. Copy the below functions to the bottom of .bash_profile and save
# Step 3. Restart terminal and done!
# Now you can run mamp from terminal!
# To start mamp type: mampstart <optional port number>
#example for above: mampstart 8080
@mwitek
mwitek / gist:2200122
Created March 25, 2012 21:49
Git push origin [branch_name] alias command
## Copy code below into .bash_profile
#alias commands for git push origin [your current branch] & git pull origin [your current branch]
alias gpush='git push origin $(git_current_branch)'
alias gpull='git pull origin $(git_current_branch)'
#function that retrieves the current branch name
git_current_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}