Skip to content

Instantly share code, notes, and snippets.

View noahsark769's full-sized avatar

Noah Gilmore noahsark769

View GitHub Profile
@noahsark769
noahsark769 / blameline.sh
Created January 6, 2017 20:41
Get history of line in file from git
# Usage: blameline <filename> <line number>
function blameline {
cmd="git log -u -L $2,$2:$1"
echo $cmd
$cmd
}
@noahsark769
noahsark769 / git-fuzzy-co
Created January 14, 2016 00:32
Fuzzy branch checkout with branch name matching
#!/usr/bin/env python
"""
git fuzzy-checkout
Same as `git checkout branch`, but with fuzzy matching if checkout fails.
Turns `git checkout barnch` into `git checkout branch`,
assuming `branch` is a branch.
"""
import difflib
@noahsark769
noahsark769 / gist:5448817
Created April 24, 2013 01:11
Can someone tell me why this is failing in seeds.rb, rails 3.2.12? It seems to work in ruby 2.0.0 but not 1.9.3 or 1.9.2. The weird thing is it works in an irb session, but not when rails runs seeds.rb (it gives a syntax error on the first line).
fft_desc = <<fft
FACT!!!: Americans spend 9.4% of their disposable income on food. That is less than any other country in the world.
CONSEQUENCES!!!: Obesity, type II diabetes, commodification of food, factory farming, corn syrup, processing, packaging, pollution, pesticides, fertilizers, and tasteless food-like products.
fft