Skip to content

Instantly share code, notes, and snippets.

@ucnv
Created May 24, 2010 12:05
Show Gist options
  • Save ucnv/411787 to your computer and use it in GitHub Desktop.
Save ucnv/411787 to your computer and use it in GitHub Desktop.
require 'ubygems'
require 'pimento'
id = ARGV.shift
exit unless id =~ /^\d+$/
x = 50
c = Pimento::Canvas.new 0,0,x+id.size*x*2,x*4
c.step = 12
d = [
lambda {|i| c.line x+i*2*x,x,2*x+i*2*x,x },
lambda {|i| c.line x+i*2*x,2*x,2*x+i*2*x,2*x },
lambda {|i| c.line x+i*2*x,3*x,2*x+i*2*x,3*x },
lambda {|i| c.line x+i*2*x,x,x+i*2*x,2*x },
lambda {|i| c.line x+i*2*x,2*x,x+i*2*x,3*x },
lambda {|i| c.line 2*x+i*2*x,x,2*x+i*2*x,2*x },
lambda {|i| c.line 2*x+i*2*x,2*x,2*x+i*2*x,3*x },
]
n = {
0 => [0,2,3,4,5,6],
1 => [5,6],
2 => [0,1,2,5,4],
3 => [0,1,2,5,6],
4 => [1,3,5,6],
5 => [0,1,2,3,6],
6 => [0,1,2,3,4,6],
7 => [0,5,6],
8 => [0,1,2,3,4,5,6],
9 => [0,1,2,3,5,6]
}
id.each_char.with_index do |c, i|
n[c.to_i].each do |r|
d[r].call i
end
end
c.to_xml.save 'a.xib'
#`open a.xib`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment