Skip to content

Instantly share code, notes, and snippets.


Jeremy Friesen jeremyf

View GitHub Profile
jeremyf /
Created Apr 1, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
View gist:412672
# I need class C to call the foo method for each module included
# that has the method foo. Order does not matter as much as each
# method getting called. alias method chain?
module ChainMethod
def chain_method(method_name)
base_method = instance_method(method_name.to_sym)
chained_method = included_modules.inject([base_method]) do |mem, mod|
if method = (mod.instance_methods.include?(method_name.to_s) ? mod.instance_method(method_name.to_sym) : nil)
mem << method
You can’t perform that action at this time.