code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreatePages < ActiveRecord::Migration def self.up create_table :pages do |t| t.column :name, :string, :limit => 30 t.column :content, :text end end def self.down drop_table :pages end end
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::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 datab...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION ...
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb unless defined?(RAILS_ROOT) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /mswin32/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end RAILS...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module IngredientsHelper end
Ruby
module RecipesHelper end
Ruby
module MeasurementsHelper end
Ruby
module MeasurementTypesHelper end
Ruby
module FoodsHelper end
Ruby
# == Schema Information # Schema version: 1 # # Table name: diets # # id :integer(11) not null, primary key # name :string(30) default(""), not null # class Diet < ActiveRecord::Base has_many :meals end
Ruby
# == Schema Information # Schema version: 1 # # Table name: measurements # # id :integer(11) not null, primary key # name :string(30) default(""), not null # abbreviation :string(6) # ratio :float not null # measurement_type_id :intege...
Ruby
# == Schema Information # Schema version: 1 # # Table name: foods # # id :integer(11) not null, primary key # name :string(30) default(""), not null # serving_size :float not null # serving_size_units :integer(11) not null # calories ...
Ruby
# == Schema Information # Schema version: 1 # # Table name: meals # # id :integer(11) not null, primary key # name :string(30) default(""), not null # class Meal < ActiveRecord::Base has_many :recipes end
Ruby
# == Schema Information # Schema version: 1 # # Table name: ingredients # # id :integer(11) not null, primary key # name :string(30) default(""), not null # amount :float not null # measurement_id :integer(11) not null # food_id :integer(11) not null ...
Ruby
# == Schema Information # Schema version: 1 # # Table name: measurement_types # # id :integer(11) not null, primary key # name :string(30) default(""), not null # class MeasurementType < ActiveRecord::Base belongs_to :measurement end
Ruby
# == Schema Information # Schema version: 1 # # Table name: recipes # # id :integer(11) not null, primary key # name :string(30) default(""), not null # directions :text # class Recipe < ActiveRecord::Base has_and_belongs_to_many :ingredients end
Ruby
# == Schema Information # Schema version: 1 # # Table name: budgets # # id :integer(11) not null, primary key # carbs :float not null # fats :float not null # calories :float not null # class Budget < ActiveRecord::Base end
Ruby
class FoodsController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list @food_pa...
Ruby
class RecipesController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list @recip...
Ruby
class MeasurementsController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list @...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_zao-jun_se...
Ruby
class IngredientsController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list @i...
Ruby
class MeasurementTypesController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list ...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateInitialSchemas < ActiveRecord::Migration def self.up create_table :foods do |t| # these are the ingredients, if in a recipe, or end nutrients if prepared food t.column :name, :string, :limit => 30, :null => false t.column :serving_size, :float, :null => false t.column :serving_size_...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::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 datab...
Ruby
$:.unshift File.join(File.dirname(__FILE__), "..","..","m") require 'test/unit' require 'datainform' class InformerTest < Test::Unit::TestCase class Warner def initialize(infor) infor.add_observer(self) end def update(infor) puts "\nInformer change-> STATE #{infor.state?.to_s}, NOTIC...
Ruby
$:.unshift File.join(File.dirname(__FILE__), "..","..","m") require 'test/unit' require 'zpop' class ZPOPTest < Test::Unit::TestCase def setup @url = 'mail.server.com' @port = 110 @user = 'user.name' end def teardown end def test_url? assert(ZPOP.url?(@url)) assert_equal(false,ZP...
Ruby
$:.unshift File.join(File.dirname(__FILE__), "..","..","m") require 'test/unit' require 'informer' class InformerTest < Test::Unit::TestCase include Informer class Warner def initialize(informer) informer.add_observer(self) end def update(infor) puts "Informer changed with notice: ...
Ruby
#!/usr/bin/env ruby # # This file is gererated by ruby-glade-create-template 1.1.3. # require 'libglade2' require 'gtk2' #require 'glib2' class HelptipGlade include GetText attr :glade def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE) b...
Ruby
require 'rubygems' require 'wx' require 'wx_sugar/all' class SugaryApp < Wx::App def on_init frame = Wx::Frame.new( nil, :title => "Arranger Application" ) frame.show() end end SugaryApp.new.main_loop()
Ruby
#!/usr/bin/env ruby # # This file is gererated by ruby-glade-create-template 1.1.3. # require 'libglade2' require 'gtk2' #require 'glib2' class HelptipGlade include GetText attr :glade def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE) b...
Ruby
require 'gtk2' window = Gtk::Window.new menu = Gtk::Menu.new menu.append(Gtk::MenuItem.new("Test1")) menu.append(Gtk::MenuItem.new("Test2")) menu.show_all window.add_events(Gdk::Event::BUTTON_PRESS_MASK) window.signal_connect("button_press_event") do |widget, event| if event.kind_of? Gdk::EventButton if...
Ruby
require "wx" # wxruby2 include Wx class MinimalApp < App def on_init Frame.new(nil, -1, "The Bare Minimum").show() end end MinimalApp.new.main_loop
Ruby
module Painter def Painter.err(error) $stderr.puts error # raise end def Painter.out(out) $stdout.puts(out) end def Painter.log(log) if $VERBOSE : Painter.out(log) end end def Painter.deb(debuginfo=nil) Painter.err('-- ') Painter.err('-- '+debuginfo) unless debuginfo==nil ...
Ruby
require 'informer' class PopAccount include Informer def initialize @paname = PAName.new @paapop = PAApop.new @passl = PASsl.new @paport = PAPort.new end def name return @paname.name end def name= (value) @paname.name = value end end
Ruby
require 'informer' require 'uri' require 'resolv' class DataInform include Informer def initialize (& function) if block_given? @validator = function else @validator = Proc.new {return true} end self.clear! end def data? return @data end def data= value if @validator.ca...
Ruby
require 'observer' module Informer include Observable # States UNDEFINED, OK, WARN, ERROR = :undefined, :ok, :warn, :error STATES = [UNDEFINED, OK, WARN, ERROR] def state? @state= UNDEFINED unless defined? @state return @state end def state= (value) # if !defined?(@state) or (STATES.ind...
Ruby
$:.unshift File.join(File.dirname(__FILE__), "..","v") require 'net/pop' require 'uri' require 'painter' class ZPOP < Net::POP3 def ZPOP.url?(addr) begin uri = URI.parse(addr) if uri.class != URI::Generic Painter.err('Address can not start with "http" or "ftp"') return false else ...
Ruby
#!/usr/bin/ruby # -*- coding: utf-8 -*- =begin # QtClass.rb for in /home/lund/Projets/zappy-poney/ConfGen # # Made by florian dewulf # Login <dewulf_f@epitech.net> # # Started on Mon Jun 10 18:25:16 2013 florian dewulf # Last update Sat Jun 22 19:22:09 2013 florian dewulf =end require 'rubygems' require 'Qt' cl...
Ruby
#!/usr/bin/ruby # -*- coding: utf-8 -*- =begin # QtClass.rb for in /home/lund/Projets/zappy-poney/ConfGen # # Made by florian dewulf # Login <dewulf_f@epitech.net> # # Started on Mon Jun 10 18:25:16 2013 florian dewulf # Last update Sat Jun 22 19:22:09 2013 florian dewulf =end require 'rubygems' require 'Qt' cl...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
source 'http://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' # for Heroku deployment - as described in Ap. A of ELLS book group :development, :test do gem 'sqlite3' gem 'ruby-debug19', :require => 'ruby-debug' gem 'cucumber-rails' ...
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
Ruby
class CreateMovies < ActiveRecord::Migration def up create_table :movies do |t| t.string :title t.string :rating t.text :description t.datetime :release_date # Add fields that let Rails automatically keep track # of when movies are added or modified: t.timestamps end ...
Ruby
Autotest.add_discovery { "rails" } Autotest.add_discovery { "rspec2" }
Ruby