Skip to content

Instantly share code, notes, and snippets.

@coleww
coleww / gist:55cea96ff08dd30af611
Created July 18, 2014 14:11
weighted shuffle in ruby.
things.sort_by do |thing|
-((thing.created_at.to_f / Time.now.to_f) * rand)
end
require 'statsd'
class RackGcHeapInstrumentation
def initialize(app)
@app = app
@statsd = Statsd.new('localhost', 8125)
end
def call(env)
GC.enable # Ensure garbage colletion is enabled
ret = @app.call(env)