Skip to content

Instantly share code, notes, and snippets.

require 'zipper'
require 'benchmark'
MAX = 5000
Benchmark.bm do |x|
x.report "zipper" do
original = Zipper.make(*(0..MAX).to_a)
zippers = (0..MAX).map{|i|
original.next.set(i)
}
@walf443
walf443 / gist:24167
Created November 12, 2008 14:21 — forked from anonymous/gist:24163
100.times do
100.times do
th = Thread.fork do
File.open("/tmp/thread/#{Thread.current.object_id}", "w") do |io|
io.puts("a" * 10000)
end
end
th.join
end
end
@walf443
walf443 / gist:25411
Created November 16, 2008 06:11 — forked from anonymous/gist:25410
require 'benchmark'
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib' )))
require 'randomaze'
COUNT = 1000
template_str = 'abc[a-z]{3}foobar[0-9あいう]{5}__hoge'
parse_result = Randomaze::String::TemplateParser.parse(template_str)
@walf443
walf443 / gist:25485
Created November 16, 2008 13:51 — forked from anonymous/gist:25484
==> randexp_spec.rb <==
begin
require 'spec/fixture'
require 'randexp'
describe "randexp" do
with_fixtures :template => :expect do
it do |template,expect|
warn template
10.times do
module Measure
class Unit
class << self
def unit_name
return nil
end
alias __inspect__ inspect
def inspect
if unit_name
diff --git root/static/js/remedie.js root/static/js/remedie.js
index 303a631..a497f90 100644
--- root/static/js/remedie.js
+++ root/static/js/remedie.js
@@ -53,6 +53,26 @@ Remedie.prototype = {
});
this.installHotKey('shift+u', function(){ remedie.toggleChannelView(false) });
+
+ // LDRize like keyborad shortcut.
@walf443
walf443 / gist:38046
Created December 19, 2008 17:06 — forked from anonymous/gist:38045
case Merb::Config[:adapter]
when 'irb'
Merb::Config.use do |c|
c[:log_auto_flush ] = true
c[:log_level] = :debug
c[:log_stream] = STDOUT
c[:log_file] = nil
# Or redirect logging into a file:
# c[:log_file] = Merb.root / "log" / "development.log"
@walf443
walf443 / tmt.vim
Created December 3, 2009 07:27 — forked from kan/tmt.vim
" Vim syntax file
" Language: tmt
" Maintainer: Kan Fushihara
" Installation:
" To automatilcally load this file when a .rhtml file is opened, add the
" following lines to ~/.vim/filetype.vim:
"
" augroup filetypedetect
" au! BufRead,BufNewFile *.tmt setfiletype tmt
" augroup END