Skip to content

Instantly share code, notes, and snippets.

@melborne
melborne / animator.rb
Created July 24, 2008 01:13
some ruby_Shoes sample codes
@app = Shoes.app do
img0 = ask_open_file #select a first image in sequence.
NUM_IMGS = 5
imgs = []
NUM_IMGS.times do |n|
imgs << img0.sub(/\d+/) { |m| n }
end
background black
@nkpart
nkpart / gist:1985
Created July 24, 2008 01:23 — forked from benhoskings/gist:1974
undefined
class PedAssignOptions < Struct.new(:links_file, :access_file, :walk_int_file, :output_file); end
class ParseFail < Struct.new(:reason); end
class ArgvParser
def parse argv
if argv.size == 1 and ['-h','--help'].include? argv.first then
return :help
end
if argv.length != PedAssignOptions.members.size then
return ParseFail.new("Incorrect number of arguments, got #{argv.size} expected #{PedAssignOptions.members.size}")
def proclol arg
{
'a' => proc { true },
'b' => proc { do_something },
'c' => proc { your_money || your_fase }
}[arg]
end
proclol('b').call
#! /bin/sh
BASEDIR=`dirname $0`
JAVA_OPTS="-Xmx2048m -Xms2048m -Xmn512m -server"
MAIN="start"
CP=$BASEDIR/../lib/jruby.jar:$BASEDIR/../lib/jgrapht-jdk1.5.jar:$BASEDIR/../lib/ped-assign.jar
java -cp $CP $JAVA_OPTS $MAIN $*
helpers do
def h(s)
Rack::Utils.escape_html(s)
end
end
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
[Wed Jul 23 - 18:30:06] [elliottcable @ Bishop] [~/Code/rat/]
-- git-rebase --interactive
[Wed Jul 23 - 18:30:10] [elliottcable @ Bishop] [~/Code/rat/]
--