Skip to content

Instantly share code, notes, and snippets.

require 'active_support/notifications'
ActiveSupport::Notifications.subscribe 'test_class.create' do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
p event.payload
end
class TestClass
def initialize
@rand_int = rand(10)
Rubinius Crash Report #rbxcrashreport
Error: signal ^@SIGSEGV
[[Backtrace]]
rbx[0x590270]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7fd4ffab2cb0]
/lib/x86_64-linux-gnu/libc.so.6(+0x8754a)[0x7fd4ff25954a]
/lib/x86_64-linux-gnu/libnss_dns.so.2(+0x3c16)[0x7fd4d1d99c16]
/lib/x86_64-linux-gnu/libc.so.6(+0xcbc9a)[0x7fd4ff29dc9a]
/lib/x86_64-linux-gnu/libc.so.6(getaddrinfo+0xde)[0x7fd4ff2a098e]
2013-04-03T20:55:19Z 12393 TID-2o44 Izi::Worker::ImageConverter JID-a8bc9ddeb26f4430515c703c INFO: Uploading image file to S3: 'ff1e3480-13c9-45c7-9463-86d195416a66/92790ae8-e703-4b29-beba-d026596db05d_480x360.jpg'
Invalid handle usage detected!
handle: 0x2da6880
checksum: 0x0
references: 1
type: 0
object: 0
Abort!
rbx(_ZN8rubinius5abortEv+0x29) [0x599549]
@etehtsea
etehtsea / rackup
Last active December 15, 2015 10:29
Rubinius Crash Report #rbxcrashreport
Error: signal SIGSEGV
[[Backtrace]]
ruby[0x5b7820]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7f1ad2f38cb0]
ruby(_ZN8rubinius12ObjectMemory31new_object_typed_enduring_dirtyEPNS_5StateEPNS_5ClassEmNS_11object_typeE+0x88)[0x680158]
ruby(_ZN8rubinius2VM22new_object_typed_dirtyEPNS_5ClassEmNS_11object_typeE+0xff)[0x6b55ef]
ruby(_ZN8rubinius2VM16new_object_typedEPNS_5ClassEmNS_11object_typeE+0x18)[0x6b5638]
@etehtsea
etehtsea / check.rb
Last active October 21, 2015 12:52
require 'benchmark/ips'
require 'monitor'
class MonitorCounter
def initialize
@counter = 0
# No idea why this doesn't work inside the class declaration
extend(MonitorMixin)
end
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '4.2.4'
gem 'sqlite3'
end
require 'active_record'
require 'minitest/autorun'
@etehtsea
etehtsea / config.ru
Created February 29, 2012 13:56
heroku ENV
# Example 5-18.
$LOAD_PATH.unshift 'lib'
require 'blog'
#if ENV['URL'] and ENV['DATABASE_URL']
if ENV['HOME'] == '/app'
# we're on heroku, no cache needed
# also, it's a read-only file system
GithubHook.disable :autopull
elsif Blog.production?
#!/usr/bin/env ruby
require "benchmark"
def method1(ar)
(ar.first..ar.last).to_a - ar
end
def method2(ar)
result_ar, prev = [], 0
ar.each do |e|
kes@ubuntu-vbox:~/Downloads$ gem i jruby-launcher --backtrace
Fetching: jruby-launcher-1.0.8-java.gem (100%)
ERROR: While executing gem ... (ArgumentError)
wrong number of arguments (2 for 1)
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:57:in `initialize'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:64:in `each'
org/jruby/RubyKernel.java:1419:in `loop'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:55:in `each'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:35:in `initialize'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `open'
$ hello.rb -sv
[729:INFO] 2011-08-15 20:45:13 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
[729:ERROR] 2011-08-15 20:45:24 :: undefined method `each' for nil:NilClass
[729:ERROR] 2011-08-15 20:45:24 :: /Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/utils.rb:344:in `initialize'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/utils.rb:338:in `new'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/content_length.rb:15:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:114:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:127:in `async_callback'
org/jruby/RubyMethod.java:121:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/goliath-0.9.2/lib/goliath/rack/async_middleware.rb:71:in `call'