This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# This is a proof-of-concept script to build every commit of ruby over the past | |
# year and store all of the resulting builds in git. The purpose of using git | |
# for storage is to take advantage of its de-duplication and compression | |
# features. | |
# | |
# Requirements: | |
# - git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rails', '~>4.0.2' | |
gem 'rubysl', :platforms => [:rbx] | |
gem 'racc', :platforms => [:rbx] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'benchmark' | |
length = 512 | |
iterations = 100000 | |
encodings = Encoding.name_list | |
Benchmark.bmbm do |r| | |
r.report("encode") do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ruby-build | |
git clone [email protected]:sstephenson/ruby-build.git ~/.ruby-build | |
cd ~/.ruby-build | |
./install.sh | |
# List definitions | |
ruby-build --definitions | |
# Install some Rubies | |
ruby-build jruby-1.7.6 ~/.rubies/jruby-1.7.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'yajl' | |
depth = ARGV[0].to_i | |
root = [] | |
a = root | |
depth.times { a << []; a = a[0] } | |
puts Yajl::Encoder.encode(root) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# When run against rails/rails commit 91684fb193a91671d682701cc1357e7b4b3fbe2b, | |
# this code produces the following output on my machine: | |
# | |
# long start @ 0.000 | |
# short start @ 0.510 | |
# short finish @ 1.511 | |
# short reported 1.511186 s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# This file is distributed under New Relic's license terms. | |
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. | |
require 'tempfile' | |
require 'rbconfig' | |
def fail(msg, opts={}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Pass 'fork' as the first argument to use Process.fork, otherwise Process.daemon is used. | |
do_fork = (ARGV[0] == 'fork') | |
thread = Thread.new do | |
loop { sleep(1) } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This implementation is adapted from Peter Cooper's - original available here: | |
# https://github.com/peterc/whatlanguage/blob/master/lib/whatlanguage/bitfield.rb | |
class ArrayBitField | |
attr_reader :size | |
attr_accessor :field | |
include Enumerable | |
ELEMENT_WIDTH = 32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'active_support' | |
class Frobnicator | |
def frobnicate | |
ActiveSupport::Notifications.instrument('frobnicate') do | |
puts 'frobnicating' | |
end | |
end |