Skip to content

Instantly share code, notes, and snippets.

# 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
@nahi
nahi / gist:759452
Created December 30, 2010 04:22 — forked from jtdowney/gist:754361
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
@nahi
nahi / .vimrc
Created May 23, 2011 12:27 — forked from eban/.vimrc
dot files
"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
@nahi
nahi / CRuby
Created April 24, 2012 06:16 — forked from shugo/CRuby
new vs mutation in Ruby
% 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)