Skip to content

Instantly share code, notes, and snippets.

View flada-auxv's full-sized avatar
🎯
Focusing

flada-auxv flada-auxv

🎯
Focusing
View GitHub Profile
class Hoge
def combination(array, num)
return [] if num == 0
return array.map {|elem| Array(elem) } if num == 1
each_with_rest(array).with_object([]) {|(elem, rest), result|
result.push(*_combination(rest, [elem], num))
}
end
@flada-auxv
flada-auxv / calc_revenue_from_gen0_kitty_sale.js
Created August 23, 2018 04:42
[WIP] Calculate revenue from CryptoKitties' gen0 kitty sale (as in some block range)
// Calculate revenue from gen0 kitty sale (as in some block range)
//
// $ node /path/to/thisFile
// { wei: "9598226439521243188",
// ether: "9.598226439521243188",
// blockRange: "6090000...6100000",
// "salesCount(only gen0 kitty)": 117,
// "birthCount(only gen0 kitty)": 148,
// "SalesCount(all the kitties)": 458 }
@flada-auxv
flada-auxv / README.md
Created August 23, 2018 09:32
internal transaction で発生した event も元の transaction の receipt に含まれる

truffle のデフォルトのディレクトリ構成で contracts/ に Test.sol を配置して

truffle console
> migrate --reset

Fuga.deployed().then(c => c.FugaEvent().options.topics[0] )
// '0x036b5e160c95e397eb8e8ad88d596c87ba315b302a96e253e54a15d259ad4e1a'

Hoge.deployed().then(c => c.HogeEvent().options.topics[0] )

Keybase proof

I hereby claim:

  • I am flada-auxv on github.
  • I am flada (https://keybase.io/flada) on keybase.
  • I have a public key ASDQh1yTlP0ZPvfFJRGsVa8gwRhhgJVM0fEKC43oE_NELAo

To claim this, I am signing this object: