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
| require 'green_shoes' | |
| require 'graph' | |
| def conv c | |
| c.to_s.sub 'Shoes::', '' | |
| end | |
| classes = [] | |
| Shoes.constants.each do |c| | |
| c = eval "Shoes::#{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
| require 'green_shoes' | |
| require 'graph' | |
| digraph do | |
| edge "C/C++", "Java" | |
| edge "Java", "Groovy" | |
| edge "Java", "Clojure" | |
| edge "Java", "JRuby" | |
| edge "C/C++", "Perl" |
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
| # test1.rb | |
| N = 20 | |
| Shoes.app do | |
| nostroke | |
| balls = [] | |
| colors = [red, blue, green, pink, yellow] | |
| v = [6, 7, -6, -7] | |
| N.times do | |
| balls << oval(rand(570), rand(470), 20, 20, fill: colors[rand 5], vx: v[rand 4], vy: v[rand 4]) | |
| 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
| # -*- encoding: utf-8 -*- | |
| #Nunca Mas Mad Libs by p.holby | |
| #[email protected] | |
| #I think I'm doing this right putting this info here I don't know I am new at this | |
| #(Editor's note: more information available at http://sorryeveryone.tumblr.com/post/5758964399 ) | |
| # Refactored for Green Shoes by ashbb | |
| require 'green_shoes' |
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
| require 'green_shoes' | |
| Point = Struct.new :x, :y | |
| Shoes.app title: 'Koch snowflake', width: 500 do | |
| def draw_koch a, b, n | |
| c, d, e = Point.new, Point.new, Point.new | |
| c.x, c.y = (2.0 * a.x + b.x) / 3, (2.0 * a.y + b.y) / 3 | |
| d.x, d.y = (a.x + 2.0 * b.x) / 3, (a.y + 2.0 * b.y) / 3 | |
| xx, yy = b.x - a.x, a.y - b.y | |
| xx, yy = xx.to_f, yy.to_f |
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
| require 'green_shoes' | |
| require 'mechanize' | |
| begin | |
| require 'hpricot' | |
| rescue LoadError | |
| require File.join(Shoes::DIR, 'ext/hpricot') | |
| end | |
| include Hpricot |
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
| require 'green_shoes' | |
| class HoverButton < Shoes::Widget | |
| def initialize(properties = {} ) | |
| @col = properties[:color] || green | |
| @hovercol = properties[:hover_color] | |
| @label = "\n#{properties[:label]}\n" || "" | |
| @margin = properties[:margin] | |
| @height = properties[:height] || 0 | |
| flow do # <<< |
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
| require 'green_shoes' | |
| class Shoes | |
| class App | |
| def tree_view_text=(tables) | |
| instance_eval do | |
| @tree_view_store.clear | |
| tree = mk_tree tables | |
| @tree_view_paths, @tree_view_rows = [], {} | |
| mk_path tree |
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
| require 'green_shoes' | |
| Shoes.app do | |
| playlist = %w[red green yellow blue black white] | |
| len = playlist.length | |
| listbox = [] | |
| x, y, w, h = 0, 0, 100, 30 | |
| blk = proc do | |
| playlist.each do |list| |
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
| # coding: UTF-8 | |
| require 'green_shoes' | |
| require 'sqlite3' | |
| Shoes.app width: 350, height: 130 do | |
| file = "simple-sqlite3.db" | |
| File.delete file if File.exist? file | |
| db = SQLite3::Database.new file | |
| db.execute "create table t1 (t1key INTEGER PRIMARY KEY,data " \ | |
| "TEXT,num double,timeEnter DATE)" | |
| db.execute "insert into t1 (data,num) values ('This is sample data',3)" |