Skip to content

Instantly share code, notes, and snippets.

@nahi
nahi / CRuby
Created Apr 24, 2012 — forked from shugo/CRuby
new vs mutation in Ruby
View CRuby
% jruby -v --server -X+C benchmark_new.rb
jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-04-24 6a30d22) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_03) [linux-amd64-java]
Rehearsal ------------------------------------------
new 1.290000 0.110000 1.400000 ( 0.974000)
color= 0.200000 0.010000 0.210000 ( 0.172000)
--------------------------------- total: 1.610000sec
user system total real
new 0.760000 0.000000 0.760000 ( 0.663000)
color= 0.160000 0.000000 0.160000 ( 0.133000)
@nahi
nahi / .vimrc
Created May 23, 2011 — forked from eban/.vimrc
dot files
View .vimrc
"scriptnames
set nocp
set completeopt=
set viminfo='100,\"500,h,%
set fileencodings=iso-2022-jp,ucs-bom,utf-8,euc-jp,default
set incsearch
set notitle
set ambiwidth=double
set nf=alpha,hex
set clipboard=unnamed
View gist:759452
require 'openssl'
key = OpenSSL::PKey::DSA.generate 1024
puts key.to_pem
cert = OpenSSL::X509::Certificate.new
cert.version = 2
cert.serial = 1
cert.subject = OpenSSL::X509::Name.new [['CN', 'Test CA']]
cert.issuer = cert.subject
View monkey_load_error.rb
# Monkey-patch LoadError's message to include the current $LOAD_PATH.
class LoadError
def initialize(*args)
super
@path = $LOAD_PATH.dup
end
def message
super + "\ncurrent path:\n" + @path.join("\n")
end