Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenta Murata mrkn

View GitHub Profile
View 1_8_7_Output.sh
$ /usr/bin/ruby -v a.rb
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
Arguments received by method:
arg_1: [1, 2, 3]
arg_2: []
Arguments received by lambda:
arg_1: [1, 2, 3]
arg_2: []
View foo_spec.rb
class Foo
def hi; end
def bar
hi if @flag
@flag = true
end
end
describe 'some' do
View knuth_subtractive_random.vim
" Knuth Subtractive Random Number Generator
let s:knuth_random = { 'index': 0, 'state': repeat([0], 56) }
function! s:knuth_random.seed(seed) dict
let l:seed = 161803398 - (a:seed < 0 ? -a:seed : a:seed)
let self.state[55] = l:seed
let [l:i, l:j, l:k] = [0, 0, 1]
for l:i in range(1, 54)
let l:j = (21 * l:i) % 55
View gist:266597
$ ruby -v -rdebug -rubygems -e 0 (~)
ruby 1.9.2dev (2009-12-27 trunk 26184) [x86_64-darwin10.2.0]
Debug.rb
Emacs support available.
ruby:0: `' (NilClass)
from /opt/ruby/trunk/lib/ruby/1.9.1/debug.rb:661:in `excn_handle'
from /opt/ruby/trunk/lib/ruby/1.9.1/debug.rb:715:in `trace_func'
from /opt/ruby/trunk/lib/ruby/1.9.1/debug.rb:905:in `block in <class:DEBUGGER__>'
from ruby:0:in `set_encoding'
You can’t perform that action at this time.