My Recent Pastes (173 and counting)

Pastes by Defiler (173 and counting)

Below are the 15 most recent pasties by Defiler.

May 29, 2007
4:35PM EDT
by Defiler

/***** BEGIN LICENSE BLOCK *****
 * Version: CPL 1.0/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Common Public
 * License Version 1.0 (the "License"); you may not use this file

May 29, 2007
11:37AM EDT
by Defiler

    def prompt(prompt, ltype, indent, line_no)
      p = prompt.dup
      p.gsub!(/%([0-9]+)?([a-zA-Z])/) do
        case $2
        when "N"

May 29, 2007
11:31AM EDT
by Defiler

hydra>./shotgun/rubinius 
sirb(eval):000> require 'pp'
=> true
sirb(eval):001> pp 'hello'
"hello"

May 28, 2007
10:22PM EDT
by Defiler

hydra>./shotgun/rubinius spec/language/method_spec.rb                                              
Defining methods with *
-------------------
 - If * by itself is the only param, method takes any number of args that are ignored
 - With a parameter name, * stores all extra arguments as an Array in it

May 28, 2007
5:04PM EDT
by Defiler

            [:iter, 
              [:call, [:self], :lambda, [:array], {:function=>true}], 
              [:lasgn, :n, [0, 0]], 
              [:block, 
                [:newline, 26, "(eval)", 

May 28, 2007
5:00PM EDT
by Defiler

## Crashes rubinius
def foo(out = 'b', formatter = lambda {|n| out * n})
  formatter.call(5)
end

May 27, 2007
4:25PM EDT
by Defiler

def baz(flonk = 'a', pebble = lambda {|n| flonk * n})
  pebble.call(5)
end

def yarr

May 27, 2007
2:02AM EDT
by Defiler

describe "Terror from the ancient world" do
  it "should let you define a singleton method on an lvar" do
    a = "hi"
    def a.foo
      5

May 27, 2007
1:21AM EDT
by Defiler

>> pp Config::CONFIG
{"sitedir"=>"/opt/local/lib/ruby/site_ruby",
 "MAKEFILES"=>"Makefile",
 "LIBRUBY"=>"libruby-static.a",
 "MAKEDIRS"=>"mkdir -p",

May 26, 2007
1:28PM EDT
by Defiler

sirb(eval):014> module M;def foo;p 5;end;end
=> nil

sirb(eval):015> module M;metaclass.methods[:foo] = self.methods[:foo];end
=> nil

May 25, 2007
3:51PM EDT
by Defiler

hydra>./shotgun/rubinius                                                                          
>> def yo(x,y=puts('hi')); p x; end
=> #<CompiledMethod:0x1008b name=yo file=(eval)>
>> yo(7,5)
7

May 25, 2007
1:31PM EDT
by Defiler

[5].each do |i|
  for j in [1,2]
    p j
  end
end

May 25, 2007
12:35PM EDT
by Defiler

An 'upto' loop with an 'each' inside it
Sexp:
  [:newline, 1, "(eval)", 
  [:iter, 
    [:call, [:lit, 1], :upto, [:array, [:lit, 10]]], 

May 25, 2007
12:35PM EDT
by Defiler

An 'upto' block with a 'for' loop inside it:
Sexp:
  [:newline, 1, "(eval)", 
  [:iter, 
    [:call, [:lit, 1], :upto, [:array, [:lit, 10]]], 

May 25, 2007
11:21AM EDT
by Defiler

hydra>cat upto2.rb                                                                         ~/work/rubinius
1.upto(10) do |i|
  for j in 1..64
    puts "rather long message"
  end

Next page

Previous page