I hereby claim:
- I am shanab on github.
- I am shanab (https://keybase.io/shanab) on keybase.
- I have a public key whose fingerprint is 894C 5D05 AEB1 B536 DD93 E2BB F7C1 EF29 F486 EE28
To claim this, I am signing this object:
| class Numeric | |
| @@currencies = { dollar: 7.15, euro: 9.26, yen: 0.068 } | |
| @@currencies.each do |currency, rate| | |
| define_method(currency) do | |
| self * rate | |
| end | |
| alias_method "#{currency}s".to_sym, currency | |
| end |
| class Numeric | |
| @@currencies = { dollar: 7.15, euro: 9.26, yen: 0.068 } | |
| def method_missing(method_id, *args, &block) | |
| singular_currency = method_id.to_s.gsub(/s$/, '').to_sym | |
| if @@currencies.has_key?(singular_currency) | |
| self * @@currencies[singular_currency] | |
| else | |
| super |
I hereby claim:
To claim this, I am signing this object:
| package cache | |
| // call is an in-flight or completed Do call | |
| type call struct { | |
| wg sync.WaitGroup | |
| // These fields are written once before the WaitGroup is done | |
| // and are only read after the WaitGroup is done. | |
| val interface{} | |
| err error |
| func permutations(a []int) [][]int { | |
| var results [][]int | |
| permute(a, 0, func(a []int) { | |
| results = append(results, a) | |
| }) | |
| return results | |
| } | |
| func permute(a []int, start int, f func([]int)) { | |
| if start >= len(a) { |