Skip to content
View development.txt
disable 1
enable 1
require 1983
load_dependency 485
[] 18
hash 15
initialize 6
View proxy.rb
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
# Copyright (C) 2009 Torsten Becker <>
require 'socket'
require 'uri'
View httpd_bench_python-SimpleHTTPServer.txt
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,
Benchmarking (be patient)
Server Software: SimpleHTTP/0.6
Server Hostname:
Server Port: 5000
View ruby-2.1.rb
class Foo
public def my_public_method
1 + 2
protected def my_protected_method
3 + 4
private def my_private_method

This is a proof-of-concept of a couple of concurrent data structures written in Ruby.

The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

View cheap_strings.rb
module CheapStrings
def `(str)
module A
extend CheapStrings
def self.make_lots_of_strings
View dead_constants.rb
#!/usr/bin/env ruby
gem "parser", "~> 1.4"
require "parser"
require "parser/ruby19"
require "set"
class ConstantDeclarationAndUseProcessor < Parser::AST::Processor
attr_reader :declared, :used
def initialize
View counters.css
* more helpful links
/* decimal counters (basic, default) */
View output
[james@kremlin00 ruby (klasscache)]$./ruby -I . -I lib ./test.rb
method cache invalidations: 18
method cache invalidations: 18
View Instrument Anything in Rails

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
Something went wrong with that request. Please try again.