Skip to content

Instantly share code, notes, and snippets.

View mbj's full-sized avatar

Markus Schirp mbj

View GitHub Profile
@mbj
mbj / errors.txt
Created May 15, 2015 23:21
errors on spree master hidden by generic exception rescue in API
bundle exec rspec spec/features/admin/orders/order_details_spec.rb
Instance method "open" is already defined in Object, use generic helper instead or set StateMachines::Machine.ignore_method_conflicts = true.
...........*...FF.F...FF.......
Pending:
Order Details as Admin Shipment edit page splitting to location should warn you if you have not selected a location or shipment
# Not yet implemented
# ./spec/features/admin/orders/order_details_spec.rb:188
Failures:
@mbj
mbj / foo.txt
Created March 30, 2015 20:48
mri-vs-ghc unscientific
mbj@mbj ~/devel/ruby/mri (trunk) % cat **/*.{c,h,rb} | wc -l
1206307
mbj@mbj ~/devel/haskell/ghc (master) % cat **/*.{hs,c,h} | wc -l
560906
@mbj
mbj / rational.txt
Created March 24, 2015 01:12
The joy of mathn.
% bundle exec rails c
[1] pry(main)> Rational(1,1)
=> 1
% irb -r rational
irb(main):001:0> Rational(1,1)
=> (1/1)
# original code
class Foo
def foo
:original
end
end
# reference made from original code
method = Foo.new.method(:foo)
@mbj
mbj / capistrano.txt
Created December 5, 2014 22:54
Capistrano doing silly things on CI.
bundle exec cap production deploy
Would you like to enable statistics? Here is an example message we would
send:
1|2014-12-05T22:44:14+00:00|2.1.5|x86_64-linux|3.3.3|9b65294c
Do you want to enable statistics? (y/N):
@mbj
mbj / actor.rb
Last active August 29, 2015 14:10
My minimal 135loc (stripped) actor implementation powering mutant
require 'concord'
module Actor
class ProtocolError < RuntimeError
end # ProtocolError
Undefined = Class.new do
INSPECT = 'Actor::Undefined'.freeze
def inspect
INSPECT
@mbj
mbj / curry.txt
Created November 28, 2014 00:30
curry
irb(main):018:0> def foo(a, b)
irb(main):019:1> "#{a}-#{b}"
irb(main):020:1> end
=> :foo
irb(main):021:0> [1,2,3].map(&self.method(:foo).to_proc.curry[2])
=> ["2-1", "2-2", "2-3"]
@mbj
mbj / segfault.rb
Last active September 28, 2017 17:50
segfault.rb
class Foo
include Enumerable
def each(&block)
[].__send__(:each, &block)
rescue Exception
end
def more
to_a # any method from enumerable
@mbj
mbj / segfault.rb
Last active August 29, 2015 14:07
segfault.rb - Intentionally crash ruby
require 'ffi'
module Segfault
extend FFI::Library
ffi_lib 'ruby'
attach_function :rb_bug, [:string, :varargs], :void
end # Segfault
Segfault.rb_bug('%s', :string, 'test bug')
@mbj
mbj / example.sh
Last active August 29, 2015 14:06
MRI 2.1.3 parser regression?
# chruby-exec 2.1.2 -- ruby y.rb
{:a=>:foo}
# chruby-exec 2.1.3 -- ruby y.rb
y.rb:2: syntax error, unexpected modifier_if
a: if true; :foo; end
^
y.rb:2: syntax error, unexpected keyword_end, expecting end-of-input