Skip to content

Instantly share code, notes, and snippets.

View cheald's full-sized avatar

Chris Heald cheald

View GitHub Profile
require 'celluloid'
$count = 0
$start = Time.now.to_f
class FooActor
include Celluloid
def listen
while true do
class ActionDispatch::Flash::FlashHash
alias_method :original_initialize, :initialize
def initialize #:nodoc:
original_initialize
@flashes = HashWithIndifferentAccess.new
end
def as_json(options = {})
[@flashes.as_json(options), @used.to_a.as_json(options), @now]
end
# The minimal reproduction case
require 'active_support/all'
Time.zone = "UTC"
Marshal.load(Marshal.dump(Time.zone.now))
# Dumping in 2.1, 2.0, and RBX-2.0.0
r2.1.0dev :001 > require 'active_support/all'
=> true
@cheald
cheald / stress.rb
Last active December 24, 2015 21:29
require 'bson'
100_000.times {
buffer = BSON::ByteBuffer.new
buffer.prepend! "string"
}
100_000.times {
buffer = BSON::ByteBuffer.new "string"
buffer.prepend! "string"
JIT: compiling JIT: compiling BSON::ByteBufferBSON::ByteBuffer##initializeinitialize ( (13811416831381141683..841116841116)
)
|| inlininginlining: : ModuleModule##====== into into initializeinitialize
|||| inlininginlining: : Rubinius::TypeRubinius::Type##object_kind_of?object_kind_of? into into ======. primitive . primitive Type.object_kind_ofType.object_kind_of ( (<nil><nil>)
)
|||||| inlininginlining: : direct class used for kind_of direct class used for kind_of (against String)
(against String)
+ + eliding redundant guardeliding redundant guard: : class class StringString ( (5151)
)
JIT: compiling BSON::ByteBuffer#initialize (1381141320.235307)
| inlining: Module#=== into initialize
|| inlining: Rubinius::Type#object_kind_of? into ===. primitive Type.object_kind_of (<nil>)
||| inlining: direct class used for kind_of (eliding because of staticly known match)
+ eliding redundant guard: class String (51)
| inlining: String#force_encoding into initialize
|+ eliding redundant guard: class String (51)
|| inlining: Rubinius::Type#coerce_to_encoding into force_encoding
||| inlining: Module#=== into coerce_to_encoding
|||| inlining: Rubinius::Type#object_kind_of? into ===. primitive Type.object_kind_of (<nil>)
JIT: compiling BSON::ByteBuffer#initialize (1381140135.326656)
JIT: compiling BSON::ByteBuffer#initialize (1381140135.326656)
| inlining: Module#=== into initialize
| inlining: Module#=== into initialize
|| inlining: Rubinius::Type#object_kind_of? into ===. primitive Type.object_kind_of (<nil>)
||| inlining: direct class used for kind_of (eliding because of staticly known match)
|| inlining: Rubinius::Type#object_kind_of? into ===. primitive Type.object_kind_of (<nil>)
||| inlining: direct class used for kind_of (eliding because of staticly known match)
+ eliding redundant guard: class String (51)
+ eliding redundant guard: class String (51)
@cheald
cheald / init.rb
Last active December 24, 2015 21:19
def initialize(initial_data="", max_size=DEFAULT_MAX_BSON_SIZE)
puts "---"
puts "initial data is: #{initial_data.class}"
@str = case initial_data
when String then
puts "Branched to String"
if initial_data.respond_to?(:force_encoding)
initial_data.force_encoding('binary')
else
initial_data
@cheald
cheald / head.html
Last active December 23, 2015 18:59
<head>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js' type='text/javascript'></script>
<script src='//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js' type='text/javascript'></script>
<script src='spy.js' type='text/javascript'></script>
<link href='/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
<link href='/css/bootstrap-responsive.min.css' rel='stylesheet' type='text/css'>
<link href='/css/style.css' rel='stylesheet' type='text/css'>
<link href='/css/spy.css' rel='stylesheet' type='text/css'>
<title>
Abandoned Jerks Tools
2.0.0p0 :012 > binding.pry
Frame number: 0/12
[2] pry(main)> show-source d.find
From: enum.c (C Method):
Owner: Enumerable
Visibility: public
Number of lines: 18