Skip to content

Instantly share code, notes, and snippets.

View brixen's full-sized avatar

Brian Shirai brixen

View GitHub Profile
Proposal: Convert Symbol table to proper Ruby objects.
Goals:
1. Add Encoding to Symbol without needing Encoding index.
2. Provide ability to garbage collect Symbols.
3. Improve concurrent allocation of Symbols.
4. Potentially improve speed of Symbol lookup.
5. Simplify 1.9 Symbol methods.
sasha:rubinius brian$ rbx -X19 stp.rb
Rehearsal --------------------------------------------------
Time.parse 11.179549 0.022043 11.201592 ( 13.465809)
Time.strptime 31.703820 0.047070 31.750890 ( 32.709087)
Time.xstrptime 9.215304 0.011662 9.226966 ( 9.915300)
---------------------------------------- total: 52.179448sec
user system total real
Time.parse 10.895463 0.018336 10.913799 ( 11.022894)
Time.strptime 31.620368 0.048868 31.669236 ( 31.898271)
@xk
xk / fib.js
Created March 13, 2012 20:27 — forked from ry/fib.js
a proper fibonacci server in node. with threads_a_gogo
var http = require('http')
var pool = require('threads_a_gogo').createPool(5).all.eval(fib);
function fib (n) {
if (n < 2) {
return 1;
} else {
return fib(n - 2) + fib(n - 1);
}
}
@brixen
brixen / minispec.rb
Created April 10, 2012 23:17
git show 958a0e9b1a06 in the Rubinius repo
# minispec
#
# Very minimal set of features to support specs like this:
#
# context "Array" do
# specify "should respond to new" do
# Array.new.should == []
# end
# end
http://localhost:3000/requests/AS?&function=AS&iata=10655083&pickup_location=PHX&pickup_date=18MAY2012&pickup_time=1000&return_date=20MAY2012&return_time=1000&cartype=E****
@jordansissel
jordansissel / readme.md
Created August 5, 2012 17:46
ruby processing speeds with the lumberjack (prototype) protocol
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
sasha:rubinius brian$ irb
1.9.3p286 :001 > "abc".force_encoding('ascii-8bit') + "\xff".force_encoding('us-ascii')
=> "abc\xFF"
1.9.3p286 :002 > a = "\x12:\xFF\xB6\xB3\x8D\xB8\x03".force_encoding('ascii-8bit')
=> "\x12:\xFF\xB6\xB3\x8D\xB8\x03"
1.9.3p286 :003 > b = "\x98~<\x84\xC3F|X".force_encoding 'us-ascii'
=> "\x98~<\x84\xC3F|X"
1.9.3p286 :004 > a + b
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and US-ASCII
from (irb):4
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do