Skip to content

Instantly share code, notes, and snippets.

View nepalez's full-sized avatar

Andrew Kozin nepalez

  • Evil Martians
  • Lisbon, Portugal
View GitHub Profile
require 'fiddle'
A = Class.new
B = Class.new
C = Class.new A
p C.superclass # => A
(Fiddle::Pointer[Fiddle.dlwrap C] + 16)[0, 8] = Fiddle::Pointer[Fiddle.dlwrap B].ref
p C.superclass # => B
require 'equalizer'
module Checkproc
InvalidValueError = Class.new(StandardError) { include Equalizer.new(:message) }
class Composite
attr_reader :left
attr_reader :right
def initialize(left, right)
@nepalez
nepalez / jruby
Last active August 29, 2015 14:24 — forked from d4rky-pl/meth_vs_proc.rb
Calculating -------------------------------------
method 56.995k i/100ms
proc 49.213k i/100ms
proc new 57.562k i/100ms
-------------------------------------------------
method 1.797M (±10.7%) i/s - 8.891M
proc 1.522M (± 8.3%) i/s - 7.579M
proc new 1.867M (± 7.9%) i/s - 9.267M
Comparison: