Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#!/usr/bin/env ruby def growl( msg ); `growlnotify -m "#{msg}"`; end NUMBERS = {:one=>1,:two=>2,:three=>3,:four=>4,:five=>5,:six=>6,:seven=>7, :eight=>8,:nine=>9,:ten=>10,:eleven=>11,:twelve=>12,:thirteen=>13, :fourteen=>14,:fifteen=>15,:sixteen=>16,:seventeen=>17,:eighteen=>18, :nineteen=>19,:twenty=>20}.freeze class Proc attr_accessor :value def +( nxt ) sleep 60*NUMBERS[self.value] growl "#{self.value.to_s.capitalize}..." nxt.call nxt end end class Object def method_missing( m, *args ) proc = lambda{ sleep 60*NUMBERS[m]; growl "...plus #{m}!" } proc.value = m proc end end one + two # And it stacks, so + three + four + five works just dandy
This paste will be private.
From the Design Piracy series on my blog: