This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def real_instance_methods_of(klass) | |
klass.instance_methods - ((klass.ancestors - [klass]).map(&:instance_methods).flatten) | |
end | |
class Class | |
def instance_methods_defined_here | |
real_instance_methods_of self | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Floppy | |
def method_missing(method, *args) | |
super unless args.length > 0 && method.to_s[-1..-1] == "=" | |
if args.first.is_a?(Proc) | |
(class << self; self; end).class_eval do | |
define_method(method.to_s[0..-2].to_sym, args.first) | |
end | |
else | |
(class << self; self; end).send(:attr_accessor, method.to_s[0...-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LazyProxy | |
# blank slate... (use BasicObject in Ruby 1.9) | |
instance_methods.each do |method| | |
undef_method(method) unless method =~ /^__/ | |
end | |
def initialize(&lazy_proxy_block) | |
@lazy_proxy_block = lazy_proxy_block | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
logfiles = Dir["#{ENV['HOME']}/**/app/../log/*.log"] # any file with a .log extension in a log directory besides an app directory... | |
logfiles.each {|file| system "echo '' > #{file}"} | |
puts "Cleaned #{logfiles.size} logs..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You always mention carbon footprint of "materials" being by far the biggest chunk of our overall carbon footprint. | |
However, I have no clue what carbon footprint of "materials" actually is. What does it entail? What exactly causes carbon emissions that fall into this "materials" category? Is it power for some machines? Is it chemical processes that somehow emit carbon dioxide? Is it any kind of transport that happens before a piece of material is in the factory? | |
(As you maybe can tell I have no clue what actually happens until a shoe is produced) |