This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package x; | |
import org.jruby.embed.ScriptingContainer; | |
public class Bar { | |
public static void main(String[] args) { | |
System.out.println(new ScriptingContainer(). | |
runScriptlet("class Foo < Java::x.Bar; end; Foo")); // => class x.Bar | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from sys import argv | |
from string import ascii_letters | |
from string import digits | |
from random import choice | |
from re import findall | |
n=int(argv[1]); charset=list(ascii_letters+digits+" ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
n=ARGV.first.to_i; charset='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '.split(//) | |
def generate(charset, n) | |
(0..n).map{(0..17).map{charset[rand(charset.length)]}.join.unpack('H*').join.scan(/.{2}/).join(' ') } | |
end | |
def decode(samples) | |
samples.map{|x|x.split.map{|a|a.to_i(16)}.pack('c*')} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'sequel' | |
Sequel.extension :migration | |
class TestSomeDatabaseRoutines | |
def setup | |
TestDatabase.down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'sequel' | |
# class TestDatabase | |
# def up; [nil, nil, nil]; end # (blah blah blah) | |
# def down; [nil, nil, nil]; end | |
# end | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# Now one can define models this way: | |
class Test < Sequel::Model(Sequel::Model.db, :implicit_dataset => false) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37c37,38 | |
< def self.Model(source) | |
--- | |
> def self.Model(source, params={}) | |
> Model.options = params |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7a8,15 | |
> def self.options=(options) | |
> @@options = options | |
> end | |
> | |
> def self.options | |
> @@options ||= {} | |
> end | |
> | |
261a270,275 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
class Fixnum | |
def < (other) | |
puts "Determining membership of #{self.inspect} in #{other.inspect}..." | |
return false unless other | |
if other.is_a? Enumerable or other.is_a? Array | |
other >= self | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/*-release | |
DISTRIB_ID=Ubuntu | |
DISTRIB_RELEASE=10.10 | |
DISTRIB_CODENAME=maverick | |
DISTRIB_DESCRIPTION="Ubuntu 10.10" | |
$ uname -a | |
Linux slim 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux |
OlderNewer