1 2 3 4 5 6 7 8 9 10
# set these in your .bash_profile, .bashrc, .zshrc first
HISTFILESIZE=100000 # how many lines to keep total
HISTSIZE=100000 # how many lines to keep for the current session
# oh-my-zsh will default to a reasonable 10000, but most bash defaults to a few hundred
# oh-my-zsh by default appends all commands to history after they are run instead of on session end
# search the history with control-r
# search for commands starting with the one you typed with alt-p
# if you don't want something to stay in your history, prefix the command with a space
View gist:c42f95ee98e909fccfe4
Verifying that +nahurst is my openname (Bitcoin username).
View gist:d2f6f9b18bc8638a3e25
1 2
service = angular.element(document).injector().get('cubeService')
service.track('plb_test', {'hi' : 'nathan'})
1 2 3 4 5 6
git reset --soft HEAD^ # when you just committed something you didn't mean to and you want to change the contents and the message
git commit --amend # when you want to change the commit message you just made
git reset file # when you have a file staged for delete that you want to unstage
git checkout file # when you want to restore that file you unstaged file to it's original version
git reset HEAD file # when you want to unstage a staged change
git reset --soft "HEAD^" # when you just committed something, but you want to undo the commit and revert everything to how it was staged before the commit
1 2 3
# minimize the use of these for better copy
# am,is,are,was,were,be,being,been,become,became,has,have,had,do,does,did,may,might,must,can,could,shall,should,will,would
1 2 3 4
cd project
rvm --rvmrc --create 1.9.2@project
cd ../project # confirm rvm with y
ruby -v # confirm version
View gist:3912888
1 2 3 4 5 6 7 8 9
# Finds the difference between a file and X changes ago
# gitdifflast path/to/file 2
# would be the difference between this version and two changes ago (when the file actually changed not just commits)
# this distinguishes between the last change and the last commit
# use "git diff HEAD@{1} path/to/file" or "git diff HEAD^ path/to/file" for that
file = ARGV.shift
change_increment = ARGV.shift.to_i
View console_spec.rb
1 2 3 4 5 6 7 8
describe "console" do
it "should run" do
#> spork
#> rspec --drb spec/models/console_spec.rb
View latency.txt
1 2 3 4 5 6 7 8 9 10
Latency Comparison Numbers Time Light Distance Approximate Light Distance
-------------------------- ---- -------------- --------------------------
L1 cache reference 0.5 ns 0.15 m Diagonal across your smartphone
Branch mispredict 5 ns 1.5 m Height of Natalie Portman
L2 cache reference 7 ns 2.1 m Height of Shaq
Mutex lock/unlock 25 ns 7.5 m Height of a school flag pole
Main memory reference 100 ns 30 m Half a Manhattan city block (North/South)
Compress 1K bytes with Zippy 3,000 ns 900 m Width of Central Park
Send 1K bytes over 1 Gbps network 10,000 ns 3,000 m Width of Manhattan
Read 4K randomly from SSD* 150,000 ns 45,000 m NYC to Hempstead on Long Island
View gist:3200127
1 2 3 4 5 6 7 8
Get the previous commit hash from the last line of .git/logs/HEAD
Replace .git/refs/heads/yourbranch with it
"git status" should now work. Note the files changed (you will copy them later)
Push this repo elsewhere (a different branch on origin)
Remove the .git directory
Pull that repo back out to a different directory
Copy over the noted files to that directory
Commit them
Something went wrong with that request. Please try again.