Skip to content

Instantly share code, notes, and snippets.

@jbodah
jbodah / gist:c286e1e992596616b8b3
Created October 23, 2014 19:53
vim substitute current word
" maps substitute command to sub out the current word for quick refactorings
nmap <leader>re :%s/<c-r>=expand("<cword>")<cr>/
@jbodah
jbodah / sym_link
Created October 27, 2014 17:13
unix symbolic link
@jbodah
jbodah / gist:6e4f10da65d3a41fec8f
Created October 29, 2014 04:10
nokogiri osx install
brew unlink gcc-4.2 # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
@jbodah
jbodah / gist:2e7bf58760f1108e9113
Last active August 29, 2015 14:08
clojure reference
Philosophy: It is better to have 100 functions operate on one data structure
than 10 functions on 10 data structures.
quoting = use symbol as data structure
clojure-noob.core=> names
["Larry Potter" "Doreen the Explorer" "The Incredible Bulk"]
clojure-noob.core=> (first names)
"Larry Potter"
clojure-noob.core=> 'names
@jbodah
jbodah / gist:daf75c2a1e509d068b2f
Created October 30, 2014 18:11
osx hidden files
defaults write com.apple.finder AppleShowAllFiles YES
@jbodah
jbodah / clean_up_merged_git
Created November 11, 2014 15:41
clean up merged git branches
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
@jbodah
jbodah / gist:4acf6730a079635d751b
Created November 13, 2014 16:58
copy current vim filename to clipboard
:!echo -n % | pbcopy
@jbodah
jbodah / gist:7b456fc975382ddb3ffe
Created November 19, 2014 03:50
reattach method
irb(main):001:0> receiver = Object.new
=> #<Object:0x007fc4a1939320>
irb(main):002:0> original = receiver.method(:to_s)
=> #<Method: Object(Kernel)#to_s>
irb(main):003:0> original == receiver.method(:to_s)
=> true
irb(main):004:0> receiver.define_singleton_method(:to_s, original)
=> :to_s
irb(main):005:0> original == receiver.method(:to_s)
=> false
@jbodah
jbodah / gist:f859fa3ffe1c45e94d57
Created November 26, 2014 20:21
ruby contexts
String.instance_eval { self }
# => String
String.class_eval { self }
# => String
String.singleton_class
# => #<Class:String>
string = String.new
watch -n1 io two_dim_list.io