code
stringlengths
1
1.73M
language
stringclasses
1 value
# 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 =>...
Ruby
# This file is copied to spec/ when you run 'rails generate rspec:install'_Y ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rspec' # Requires supporting ruby files with custom matchers and macros, etc, # in spe...
Ruby
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'rspec', :version => 2 do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } # Rails example watch(%r{^spec/.+_spec\.rb$}) watch(%r{^app/(.+)...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Blog::Application
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
class AddThingsDeadline < ActiveRecord::Migration def self.up add_column :things, :deadline, :date end def self.down remove_column :things, :deadline end end
Ruby
class AddThingsPriority < ActiveRecord::Migration def self.up add_column :things, :priority, :integer, :default => 0 end def self.down remove_column :things, :priority end end
Ruby
class CreateThings < ActiveRecord::Migration def self.up create_table :things do |t| t.column :title, :string t.column :description, :text t.column :deadline, :date t.column :priority, :integer, :default => 0 t.column :category, :string t.column :img_url, :string en...
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
#!C:/workspace/InstantRails/InstantRails-1.7-win/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" -...
Ruby
#!C:/workspace/InstantRails/InstantRails-1.7-win/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 cra...
Ruby
#!C:/workspace/InstantRails/InstantRails-1.7-win/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" -...
Ruby
#!C:/workspace/InstantRails/InstantRails-1.7-win/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/dispatch...
Ruby
#!C:/workspace/InstantRails/InstantRails-1.7-win/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 cra...
Ruby
#!C:/workspace/InstantRails/InstantRails-1.7-win/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/dispatch...
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/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/runner'
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/destroy'
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/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/about'
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/console'
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/process/spawner'
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/inspector'
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/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/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/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/generate'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module AdminHelper end
Ruby
class Thing < ActiveRecord::Base end
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 => '_28Things_s...
Ruby
class AdminController < 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 if param...
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
# 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 =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
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
# 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
# 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
class Model def initialize @figurArray = Array.new end def nyFigur(figur) @figurArray << figur end def getFigur(num) @figurArray[num] end def getAntalFigurer @figurArray.length end end $model = Model.new =begin class Samler attr_reader :figurer attr_writer :figurer def initialize...
Ruby
$krop.Drej(45,4) $krop.Flyt(20,10)
Ruby
class Model def initialize @figurArray = Array.new end def nyFigur(figur) @figurArray << figur end def getFigur(num) @figurArray[num] end def getAntalFigurer @figurArray.length end end $model = Model.new class Led attr_reader :del, :opx, :opy, :nedx, :nedy attr_writer :del, :opx, :opy, :nedx, :nedy ...
Ruby
Begynd blok $krop.Flyt(20,10) $krop.Drej(10,4) Slut blok Begynd blok $krop.Flyt(-10,0) $krop.Drej(-10,4) Slut blok
Ruby
class Model def initialize @figurArray = Array.new end def nyFigur(figur) @figurArray << figur end def getFigur(num) @figurArray[num] end def getAntalFigurer @figurArray.length end end $model = Model.new class Led attr_reader :del, :opx, :opy, :nedx, :nedy attr_writer :del, :opx, :opy, :nedx, :nedy ...
Ruby
$krop = Mand.new("$krop")
Ruby
Begynd blok $krop.Flyt(20,10) $krop.Drej(10,4) Slut blok Begynd blok $krop.Flyt(-10,0) $krop.Drej(-10,4) Slut blok
Ruby
class Model def initialize @figurArray = Array.new end def nyFigur(figur) @figurArray << figur end def getFigur(num) @figurArray[num] end def getAntalFigurer @figurArray.length end end $model = Model.new class Led attr_reader :del, :opx, :opy, :nedx, :nedy attr_writer :del, :opx, :opy, :nedx, :nedy ...
Ruby
class Model def initialize @figurArray = Array.new end def nyFigur(figur) @figurArray << figur end def getFigur(num) @figurArray[num] end def getAntalFigurer @figurArray.length end end $model = Model.new class Led attr_reader :del, :opx, :opy, :nedx, :nedy attr_writer :del, :opx, ...
Ruby
SET app_name create-dmg VERSION create-dmg.cur create-dmg heads/master NEWDIR build.dir temp %-build - NEWFILE create-dmg.zip featured %.zip % COPYTO [build.dir] INTO create-dmg [create-dmg.cur]/create-dmg INTO sample [create-dmg.cur]/sample INTO support [create-dmg.cur]/support SUBSTVARS [build.dir<alter>]/c...
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
# Compass configurations sass_path = File.dirname(__FILE__) css_path = File.join(sass_path, "..", "css") # Require any additional compass plugins here. images_dir = File.join(sass_path, "..", "img") output_style = :expanded environment = :production
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
# Require any additional compass plugins here. http_path = "/" css_dir = "css" sass_dir = "scss" images_dir = "img" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed # To enabl...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
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 # Enable threaded mode # config.threadsafe! # Use a different logger for distributed setups # config....
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 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 = '2.2...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
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
# 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 helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details...
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/dbconsole'
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/request'
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/performance/request'
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' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
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/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