code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class CreateProductorigins < ActiveRecord::Migration
def self.up
create_table :productorigins do |t|
t.integer :product_id, :null => false
t.integer :national_id, :null => false
t.integer :farm_id, :null=>false
t.timestamps
end
end
def self.down
drop_table :productorigins
e... | Ruby |
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
current_user != :false
end
# Accesses the current user from the session.
def current_user
@current_user ||= ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user] = user ? users(user).id : nil
end
def content_type(type)
@request.env['Content-Type'] = type
end
def accept(accept)
@request.env["HTTP_ACCEPT"] = accept
en... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test da... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# o... | Ruby |
require 'rake/clean'
CLEAN.include('dist/kmltree.css', 'dist/kmltree.min.js', 'dist/kmltree.js', 'dist/images', 'src/_sprites.sass', 'sprites-url')
CLOBBER.include('compiler')
SRC = FileList[ 'src/kmltreeManager.js', 'src/base64.js', 'src/tmpl.js', 'src/kmldom.js', 'src/URI.js', 'src/kmltree.js', 'src/googleLayers.js... | Ruby |
#! /usr/bin/ruby
#author newdongyuwei@gmail.com
if GC.respond_to?(:copy_on_write_friendly=)
GC.copy_on_write_friendly = true
end
$KCODE = 'UTF-8'#解决中文乱码问题
%w(rubygems sinatra sinatra/base net/http net/https json erubis eventmachine em-websocket).each{|lib|require lib}
require 'ruby-growl'if RUBY_PLATFORM.downcas... | Ruby |
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
Fetion_Status = {
'在线' => '1' ,
'忙碌' => '2' ,
'离开' => '3' ,
'隐身' => '4'
}
EM.run{
mobile = '13651368727'#my mobile
password = 'xxxx'#my fetion password
headers = {
'Host' => 'f.10086.cn',
'Referer' => 'http://f.10086.cn/im/l... | Ruby |
$:.unshift '.'
ENV['RACK_ENV'] = "production"
require 'rubygems'
require 'fetion_robot'
run Sinatra::Application
| Ruby |
#! /usr/bin/ruby
#author newdongyuwei@gmail.com
require 'rubygems'
require "sinatra"
require 'oauth'
require 'oauth/consumer'
require 'yaml'
require 'logger'
class SinaWeiboClient
def initialize()
@loger = Logger.new(STDOUT)
@loger.level = Logger::DEBUG
auth = YAML.load(File... | Ruby |
#! /usr/bin/ruby
#author newdongyuwei@gmail.com
if GC.respond_to?(:copy_on_write_friendly=)
GC.copy_on_write_friendly = true
end
$KCODE = 'UTF-8'#解决中文乱码问题
%w(rubygems fileutils sinatra sinatra/base net/http net/https json).each{|lib|require lib}
require 'ruby-growl'if RUBY_PLATFORM.downcase.include?("darwin")
class... | Ruby |
require 'mkmf'
$CPPFLAGS = $CPPFLAGS + " -I../../include"
$LDFLAGS = $LDFLAGS + " -L../../"
$LIBS = $LIBS + " -lhpdf -lpng -lz"
create_makefile 'hpdf'
| Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- demo.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appea... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- encryption.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- font_example.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright noti... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- arc_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear ... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- ext_gstate_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice ... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- ttfont_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appe... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- text_demo2.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- line_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- slideshow_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice a... | Ruby |
module Combat
module Projectiles
class Projectile
@@missiles=CArray.new
attr_reader :x, :y, :speed, :range, :angle, :id
def initialize(x, y, speed, range, angle, image, colmap, pushback=true, damagescript=false)
@x,@y=x,y
@startx,@starty=x,y
@speed=speed
@range=range
@angle=angle... | Ruby |
#require "imgs.rb"
require "movement.rb"
require "dataparse.rb"
require "ai.rb"
$players = {}
$players_data = {}
$players_defaults = {}
#The Player class represents the user's character. It acts as an iterface between the MovementBase class and user input from the GameWindow.
#Player also allows for "bootstra... | Ruby |
class Animation
DefRoot="data/characters/animations.def"
DumpFile="logs/dump/anims.dump"
@@animations = {}
attr_reader :animObj,:name,:src,:speed, :width, :height, :loop
def initialize(name,src,speed,width,height,loop=true)
@animObj=Gosu::Image::load_tiles($window,src,width,height,false)
@src=s... | Ruby |
#CArray is an Array which does not compact. CArrays place a priority on preserving the indices of each element in order to allow identification of elements thier indices.
#CArrays are used by the Window and Tile classes.
class CArray < Array
public
@intsize
def initialize
@intsize=0
super
end
... | Ruby |
require "gosu.so"
class String
def subVars!
# gsub!("%building_sprite_root%",MapImage::BuildingSpriteRoot)
# gsub!("%item_sprite_root%",MapImage::ItemSpriteRoot)
# gsub!("%terrain_sprite_root%",MapImage::TerrainSpriteRoot)
# gsub!("%map_root%",Map::Root)
# gsub!("%materials_root%",Materi... | Ruby |
# Copyright (C) 2004 Gregoire Lejeune <gregoire.lejeune@free.fr>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#... | Ruby |
require "gosu.so"
=begin
$window=Gosu::Window.new
Sound
=end
module Audio
class AudioBase
attr_reader :file, :type, :obj
def initialize(file="")
if file!=""
@file=file
end
end
def play
@obj.play
end
end
class Sound < AudioBase
def initialize(file="")
super(fi... | Ruby |
module Collision
module Bresenham
def bresenham(x0, y0, x1, y1, &block)
dy = y1 - y0
dx = x1 - x0
if dy < 0 then dy = -dy; stepy = -1 else stepy = 1 end
if dx < 0 then dx = -dx; stepx = -1 else stepx = 1 end
dy <<= 1 # dy is now 2*dy
... | Ruby |
!rb $flog.info("Plugin Diag") {"Status OK"} | Ruby |
require "CArray"
#require "debug"
#The Tile class represents a rectangular region on the screen.
#It is synonymous with the Rect structure used in many C programs.
class Tile
@@tiles = CArray.new
#@@tile = []
attr_accessor :x1,:y1,:x2,:y2,:inclusive,:id
#@inclusive decides whether or not tile... | Ruby |
require "gosu"
require "mouse.rb"
require "button.rb"
require "carray.rb"
#The GameWindow class is the central hub of the program. It is utimately responsible for all input and output (exept for logging output).
#The main game loops can be found in this class.
class GameWindow < Gosu::Window
Static=true
... | Ruby |
puts "Session Repair"
puts "--------------"
puts "..."
f=File.new("../session.txt","w")
begin
f.write("\fOFF")
puts "Repair Successful"
rescue
puts "Repair Failed"
print "Error: "+$!
puts "\nSecond Attempt..."
begin
rescue
puts "Second Attempt Failed."
end
ensure
f.close
puts
puts "Press ENTER to ... | Ruby |
def main
puts " ______________________"
puts "|Error Report Generator|"
puts "|______________________|"
puts ""
puts "ERG will now launch the main game. Try to replicate the error you previously encountered. If this is not possible, exit and use the instuctions in the user manual to manually generate an ... | Ruby |
puts "Script Executer Utility"
puts "-----------------------"
$error=false
$errname=""
$errlin=0
def load(script)
s=File.new(script)
sc=""
s.each { |line|
sc+=line+"\n"
}
eval("begin\n"+sc+"\nrescue\n$error=true\n$errname=$!\n$errlin=$@\nend")
if $error
$error=false
throw
... | Ruby |
require "lib/inifile"
require "lib/ini"
require "ftools"
puts " ----------------------------"
puts "| /\\ P R E F E R E N C E S|%"
puts "| /__\\ E D I T O R |%"
puts "| /\\ /\\ |%"
puts "|/__\\/__\\ WW-P COLLAB |%"
puts "| LOZ PROJECT |%"
puts "|-------... | Ruby |
puts "Error Report Packager"
puts "..."
game_vers="pre alpha <0.0005"
pkg_vers="pre release 0.91"
f=File.new "REPORT","w"
f.write Time.new.to_s+"\n\n"
f.write "Env\n{\nRuby Version=#{VERSION}\nPlatform=#{RUBY_PLATFORM}\nProc=#{$$}\n}"
f.write "\n\n"
f.write "Pkg\n{\nPkger Version=#{pkg_vers}\nExpected Game=#{ga... | Ruby |
require "fileutils.rb"
bad=true
ans=""
puts "This program will clear all logs. Are you sure you wish to continue? (Y/N)"
while bad
ans = gets.chomp!
if ans=="Y" or ans=="y"
bad=false
elsif ans=="N" or ans=="n"
exit
else
puts "Bad command.\n\n"
end
end
FileUtils.rm_f Dir... | Ruby |
module AI
class Status #current action
Idle=0 #action = job
Engaged=1 #action = attack
Fleeing=2 #action = flee
Subdued=3 #unable to act
InSquad=4 #let squad leader handle AI
Engaging=5 #enroute to combat
FallingBack=6
JoiningSquad=7
Waiting=8 #last order finished, awaiting new one
end... | Ruby |
module Movement
class Direction
Forward=0 #facing screen
Backward=1 #facing away from screen
Left=2
Right=3
end
class Action
Standing = 0
Walking = 1
Running = 2 #no longer equivalent to walking ;)
Dieing = 23
DefAtk = 16
Atk1 = 3
Atk2 = 4
Atk3 = 5
Atk4 = 6
Atk5 = 7
A... | Ruby |
require "window.rb"
require "framework.rb"
require "fileutils.rb"
require "dataparse.rb"
#loads game graphics and draws the game map
class Environment
class Map
def Map.loadMaterials
terrain=ObjectScript::ObjectClass.new("terrain")
terrain.addStringProperty("name")
terrain.addString... | Ruby |
module Error
module ScriptErrors
#A generic class for reporting errors which deal with parsing files.
class ScriptError < Exception
@mess
@messprt
@extra
def cLASS
return "Script"
end
def initialize(script,line,mess,*extra)
@messprt=mess
setMessage(line,script,extra) unless scrip... | Ruby |
require "tile.rb"
require "window.rb"
module GUIBase
#The Button class takes a Tile (a rectangular region) and associates it with an image.
#Buttons are not capable of any input or output.
class Button < Tile
Image=true
Rect=false
@@buttonId=0
@@instances = []
attr_reader :type,:src... | Ruby |
class Ini < IniFile
class Option
attr_reader :name, :values, :defaultValue
def initialize(name,values=:any,defval=:none)
@name=name
@values=values
@defaultValue=defval
end
end
def load(file)
super(file)
if @hhxData.nil? == false
@hhxData.each { |key,valu... | Ruby |
#PlaceHolder Module
puts "\n**null.rb included**\n"
$flog.warn("Null.rb") {"Null.rb included"} | Ruby |
class Character
attr_accessor :ai, :allegiance, :vision
#ai = ai config object
#alegiance = used to differentiate friend from foe
#vision = range at which enemies can be detected.
attr_reader :name, :animationfile
def initialize(name,animationfile,ai)
end
end
| Ruby |
module Mouse
class Cursor
attr_reader :img, :visible, :imgObj
def initialize(img,visible)
@img=img
@visible=visible
@imgObj=Gosu::Image.new($window,img,true)
@forced=false
end
def toggleVisible
if not @forced
@visible=!@visible
end
end
... | Ruby |
#require "ruby-debug"
$version = "0.007.1(D)"
begin
f=File.new("session.txt","r")
ln=f.readline
f.close
if ln=="\fON"
puts "Legend of Zelda - Startup"
puts "-------------------------\n"
puts "Another instance of this program is currently running.\n"
puts "Due to resource conflicts, multiple in... | Ruby |
require "window.rb"
require "mouse.rb"
require "gui.rb"
module Menu
#A StaticScreen is a menu. It suspends the game and redirects all input to itself.
#StaticScreen is typically used through derivation, although it can be used otherwise.
#StaticScreen#start suspends the game and starts the menu. StaticScreen#... | Ruby |
class Game
attr_reader :name,:levels,:levelno
def initialize(name="Untitled",levels=0)
@name=name
@levels=levels
@levelno=0
end
def getLevelNo
return @levelno
end
def to_s
return "{[COMPONENT::Game]::Name="+@name+"}\n"
end
end
class Storyline
attr_reader :eventType,:... | Ruby |
require "inifile.rb"
module Saveload
#Save is the savegame file format. Save files are zipfiles composed of a header (save.svh) ad several content files.
#The header contains the following:
# * The version of the game engine which wrote the savefile
# * The version of the savefile format
# * A date
# * A tim... | Ruby |
require "button.rb"
#require "launch.rb"
module GUI
#The Widget class is an interface between the button class and the window class which allows for user interaction with an area of the screen. This area is referred to as the widget.
#To make a Widget, simply create a class derived from Widget and override meth... | Ruby |
require "animloader.rb"
module Dataparse
#A generic Datafile is a comma and linebreak delimited file used to store lists of data. The format is meant to be as compact as possible, while remaining easily editable.
#Each line of the file is an element, and each comma-delimited item is an atribute of its element. A... | Ruby |
#!/usr/bin/env ruby
require 'json'
RESET_PROB = 0.15;
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
last_change = json['state'].to_f
return {:edges => :OUT_EDGES} if last_change > 1e-2
return {:edges => :NO_EDGES}
end
def gather(json)
edge = j... | Ruby |
#!/usr/bin/env ruby
require 'json'
INFINITY = 1e99
class String
alias :old_to_f :to_f
def to_f
return INFINITY if 0 >= self.length
self.old_to_f
end
end
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
{:edges => :OUT_EDGES}
end
def gather(jso... | Ruby |
#!/usr/bin/env ruby
def colorize(text, color_code)
"\e[0;#{color_code}m#{text}\e[0m"
end
def red(text)
colorize(text, 31)
end
def green(text)
colorize(text, 32)
end
def cyan(text)
colorize(text, 36)
end
begin
# open new terminal
fd = IO.sysopen("/dev/tty", "r")
term = IO.new(fd,"r")
thread = T... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# MyLogger.rb - saimple logging utility
# Copyright (C) 2000-2003, 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>.
require 'monitor'
# Simple logging utility.
#
# Author:: NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
# Documentation:: NAKAMURA, Hiroshi and Gavin Sinclair
# License::
# You can redistribute it and/or ... | Ruby |
require 'rexml/document'
def LoadXmlAndInput(filename,ie)
begin
inputXml = open("data\\"+filename) { |f| f.read }
inputs = REXML::Document.new(inputXml)
inputs.root.each_element do |node|
if node.attributes['type'] == ("textbox")
if node.attributes['p_name'] == ("name")
... | Ruby |
require 'win32ole'
require 'logger'
#Excel interface class.
#This class provides many simple methods to reading data records from Excel spreadsheets.
#Below is a bief example of how to use this class (see unit test (test_XLS.rb) for more usage examples)
# require 'xls'
# xlFile = XLS.new('c:\m... | Ruby |
require 'watir'
@ie = Watir::IE.new
@ie.goto("http://www.baidu.com")
elementIdType="id"
@ie.text_field(:"#{elementIdType}","kw").set("text");
| Ruby |
#!/usr/bin/env ruby
require 'rubygems'
require 'mqtt'
MQTT::Client.connect('localhost',1883) do |client|
client.get('#') do |topic,message|
puts "#{topic}: #{message}"
end
end
| Ruby |
# Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
# Lincense: New BSD Lincense
require "web_socket"
require "thread"
Thread.abort_on_exception = true
if ARGV.size != 2
$stderr.puts("Usage: ruby shell.rb ACCEPTED_DOMAIN PORT")
exit(1)
end
server = WebSocketServer.new(
:accepted_domains => [ARGV[0]],
:por... | Ruby |
# Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
# Lincense: New BSD Lincense
# Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75
# Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
# Reference: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07
# Ref... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/assets/css"
sass_dir = "/assets/scss"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# out... | Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | Ruby |
#!/usr/bin/env ruby
require 'rubygems'
require 'mqtt'
MQTT::Client.connect('localhost',1883) do |client|
client.get('#') do |topic,message|
puts "#{topic}: #{message}"
end
end
| Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
require 'rubygems' rescue LoadError
require 'wx'
# Simple test application for keyword arguments to Sizer#add_item and
# ToolBar#add_item. Originally contributed by C... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This example lists the various system settings that WxRuby knows
# about. To use it, run it an... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# Example demonstrating the use of Wx::ScrolledWindow and the
# ScrollWinEvents
class ScrollF... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This sample demonstrates the use of Activate Events. These are
# generated when a frame become... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
include Wx
ID_CHOICE = 1000
class ChoiceDlg < Dialog
def initialize
super(nil, -1, ... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This sample demonstrates the use of Activate Events. These are
# generated when a frame become... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MySashFrame < Wx::Frame
def initialize(title, pos, size, style = Wx::DEFAULT_FRAME_STY... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MyFrame < Wx::Frame
attr_reader :mini
def initialize(title, pos, size, style = Wx... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This example lists the various system settings that WxRuby knows
# about. To use it, run it an... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MyFrame < Wx::Frame
def initialize(title, pos, size)
super(nil, :title => title, ... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
require 'rubygems' rescue LoadError
require 'wx'
# Simple test application for keyword arguments to Sizer#add_item and
# ToolBar#add_item. Originally contributed by C... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This simple sample demonstrates how to use Ruby 1.8's lightweight
# (green) threads to execute non-GUI c... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# Example demonstrating the use of Wx::ScrolledWindow and the
# ScrollWinEvents
class ScrollF... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MyFrame < Wx::Frame
def initialize(title, pos, size)
super(nil, :title => title, ... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MySashFrame < Wx::Frame
def initialize(title, pos, size, style = Wx::DEFAULT_FRAME_STY... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
include Wx
ID_CHOICE = 1000
class ChoiceDlg < Dialog
def initialize
super(nil, -1, ... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
# This simple sample demonstrates how to use Ruby 1.8's lightweight
# (green) threads to execute non-GUI c... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MyFrame < Wx::Frame
attr_reader :mini
def initialize(title, pos, size, style = Wx... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
ArtClients = [ "Wx::ART_TOOLBAR",
"Wx::ART_MENU",
"Wx::ART_FRAME_ICON",
... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class MySplitter < Wx::SplitterWindow
def initialize(parent, id, log)
super(par... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
def make_simple_box1(win)
box = Wx::BoxSizer.new(Wx::HORIZONTAL)
box.add(Wx::Button... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class TestPanel < Wx::Panel
def initialize(parent, log)
super(parent, -1)
... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class TestPanel < Wx::Panel
def on_set_focus(event)
@log.write_text("on_... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
$RBUT1 = 5000
$RBUT2 = 5001
$RBUT3 = 5002
$RBUT4 = 5003
$RBOX1 = 5004
$RBOX2 = 5005
... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class Log
def write_text(txt)
Wx::log_message(txt.chomp)
end
alias write write_text
end
class... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
module Demo
def Demo.run(frame, nb, log)
max = 20
dlg = Wx::ProgressDi... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class TestPanel < Wx::Panel
def initialize(parent, log)
super(parent, -1, Wx::DEFAULT_POSITION, W... | Ruby |
#!/usr/bin/env ruby
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
begin
require 'rubygems'
rescue LoadError
end
require 'wx'
class TestPanel < Wx::Panel
def initialize(parent, log)
super(parent, -1, Wx::DEFAULT_POSITI... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.