View a_terrible_thing.txt
[aaron@TC omglolwut (master)]$ cat lib/tasks/disable_autoload_during_migrations.rake
task :disable_autoload do
ActiveSupport::Dependencies.class_eval do
extend Module.new {
def load_file(path, const_paths = loadable_constants_for_path(path))
return if path.starts_with? File.join(Rails.application.root, 'app', 'models')
super
end
}
end
View ruby.patch
diff --git a/compile.c b/compile.c
index 995ff89..f0528af 100644
--- a/compile.c
+++ b/compile.c
@@ -1697,6 +1697,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case TS_CALLCACHE:
{
struct rb_call_cache *cc = &iseq->body->cc_entries[ISEQ_COMPILE_DATA(iseq)->ci_index + ISEQ_COMPILE_DATA(iseq)->ci_kw_index - 1];
+ cc->serial = rb_next_ic_serial();
generated_iseq[code_index + 1 + j] = (VALUE)cc;
View omg.rb
class A
def foo; end
end
class B
def foo; end
end
def omg obj
obj.foo # `obj` is only ever two types: A and B
View n2callsite.csv
site and types calls at site
Set - Array @ 17900 313640
Array - NilClass @ 17747 195583
Symbol - String @ 241594 130207
Fixnum - NilClass @ 163777 62628
Array - NilClass @ 214446 53352
Symbol - String @ 210564 38614
Float - Fixnum @ 259287 25202
ActiveSupport::SafeBuffer - ActionView::OutputBuffer @ 162148 21423
ActiveSupport::SafeBuffer - ActionView::OutputBuffer @ 162150 21423
View boom.rb
# Run this with rspec 2 or 3, it will randomly fail in ruby 2.3.0-preview2 when the ".new" example runs last.
# It fails with
# 1) SmallCircle .new
# Failure/Error:
# def area
# super(2)
#
# ArgumentError:
# wrong number of arguments (given 1, expected 0)
# inline_spec.rb:23:in `area'
View callsite_data.csv
number of types number of calls
1 23309344
2 10341277
3 439291
4 378137
5 120699
6 100403
7 288376
8 222454
9 37247
View pic_logging.diff
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index d54c511..ebe92dc 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2060,6 +2060,8 @@ int ruby_native_thread_p(void);
#define RUBY_EVENT_THREAD_BEGIN 0x0400
#define RUBY_EVENT_THREAD_END 0x0800
#define RUBY_EVENT_FIBER_SWITCH 0x1000
+#define RUBY_EVENT_INLINE_CACHE_HIT 0x2000
+#define RUBY_EVENT_INLINE_CACHE_MISS 0x4000
View mt.rb
#!/usr/bin/env ruby --disable-gems
# Tab completion for minitest tests.
#
# INSTALLATION:
#
# 1. Put this file in a directory in your $PATH. Make sure it's executable
# 2. Run this:
#
# $ complete -o bashdefault -f -C /path/to/this/file.rb ruby
View fallout.rb
##
# Program to help you hack terminals in Fallout
#
# Usage:
#
# Run the program once with a list of words in the terminal. The program will
# output a list, and the first word in the list is the word you should pick
# because it will eliminate the most possibilities.
#
# If that word is incorrect, then re-run the program with two lists, first the
View bench.rb
require 'active_record'
class Topic < ActiveRecord::Base
end
20.times do |i|
Process.waitpid fork {
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.connection.instance_eval do