code
stringlengths
1
1.73M
language
stringclasses
1 value
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) Blog::Application.load_tasks
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
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) Blog::Application.load_tasks
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.6' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3...
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
# 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
environment = :production project_type = :stand_alone http_path = "/" css_dir = "../styles" sass_dir = "." images_dir = "images" sass_options = { :line_numbers => false, :debug_info => false } # output_style = :compressed # output_style = :compact output_style = :expanded
Ruby
require 'webrick' include WEBrick s = HTTPServer.new( :Port => 2010, :DocumentRoot => Dir::pwd ) s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts') s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles') trap('INT') { s.stop } s.start
Ruby
1U 8 STAGE COLUMN SECTION, ALL SECTIONS RIGOROUS ( CHEM. ENG. ) |WEST0479 508 30 96 382 rua 479 479 1910 0 (16I5) (20I4) (5E14.6) 1 4 7 10 12 14 19 24 27 30 33 ...
Ruby
valid 4-by-4 test matrix (A=sparse(magic(4)) in MATLAB) |magic4 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 0 5 9...
Ruby
Rutherford/Boeing file but with 5th H/B line |magic4b 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) F ignore 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 ...
Ruby
valid symmetric matrix (A=A+A^T where A=sparse(magic(4))) |sym4 3 1 1 1 isa 4 4 10 0 (26I3) (40I2) (26I3) 1 5 8 10 11 1 2 3 4 2 3 4 3 4 4 32 7 12 17 22 17 22...
Ruby
cp is truncated 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9
Ruby
invalid dimensions 3 1 1 1 iua -4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
row indices out of range 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 9 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
invalid symmetric matrix (entries in upper part of A) 3 1 1 1 isa 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15...
Ruby
duplicate row indices 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 3 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
invalid matrix type 3 1 1 1 ixa 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
invalid symmetric matrix (rectangular) 3 1 1 1 isa 6 4 10 0 (26I3) (40I2) (26I3) 1 5 8 10 11 1 2 3 4 2 3 4 3 4 4 32 7 12 17 22 17 22 12 27 2
Ruby
row indices jumbled 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 2 1 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
numerical values truncated 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14
Ruby
invalid matrix type 3 1 1 1 iux 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
cp is mangled 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 42 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
cp is mangled 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 42 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
row indices truncated 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1
Ruby
invalid matrix type 3 1 1 1 xxx 4 4 16 0 (26I3) (40I2) (26I3) 1 5 9 13 17 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 16 5 9 4 2 11 7 14 3 10 6 15 13 8 12 1
Ruby
truncated with 5th Harwell/Boeing line 3 1 1 1 iua 4 4 16 0 (26I3) (40I2) (26I3) F
Ruby
HB/west0479; 1983; A. Westerberg; ed: I. Duff et al. |267 508 30 96 382 rua 479 479 1910 0 (16I5) (20I4) (5E15.7) 1 4 7 10 12 14 19 24 27 30 33 ...
Ruby
HB/lap_25; 1980; I. Duff; ed: I. Duff et al. |1177 5 1 4 0 psa 25 25 97 0 (26I3) (26I3) 1 5 10 15 20 23 27 32 37 42 45 49 54 59 64 67 71 76 81 ...
Ruby
Meszaros/farm; 2004; ; ed: C. Meszaros |1710 6 1 2 3 ira 7 17 41 0 (26I3) (40I2) (20I4) 1 2 3 4 5 6 9 13 15 18 21 24 28 32 36 40 41 42 1 ...
Ruby
HB/bcsstk01; 1982; J. Lewis; ed: I. Duff et al. |23 68 3 9 56 rsa 48 48 224 0 (20I4) (26I3) (4E20.12) 1 9 17 25 31 37 43 49 55 62 66 70 75 85 ...
Ruby
#!/usr/bin/ruby model_url = "http://dl.dropbox.com/u/2701879/bgod" #objreader = "svn checkout http://objreader.googlecode.com/svn/trunk/ objreader" #puts "Getting objreader..." #puts "Sorry windows, checkout with TortoiseSVN" unless system objreader Dir.mkdir 'models' Dir.chdir 'models' puts "Getting file list..." ...
Ruby
require 'mongrel_cluster/recipes' set :use_sudo, false set :runner, nil set :application, "bluegoldwebsite" set :svn_user, ENV['svn_user'] || "VisualBasicIMP" set :svn_password, Proc.new { Capistrano::CLI.password_prompt('SVN Password: ')} set :repository, Proc.new {"--username #{svn_user} " + "--password #{svn_passw...
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 =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
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
load 'deploy' if respond_to?(:namespace) # cap2 differentiator load 'config/deploy'
Ruby
module BlogAdminHelper end
Ruby
module AdminHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module NewspaperHelper end
Ruby
class Blog < ActiveRecord::Base end
Ruby
class Article < ActiveRecord::Base validates_presence_of :title, :author, :body validates_uniqueness_of :title validates_format_of :image_url, :with => %r{\.(gif|jpg|png)$}i, :message => "must be a url for a GIF, JPG, or PNG" @news = "News" def self.find_art...
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 @article...
Ruby
class NewspaperController < ApplicationController @@contentList = ["Feature", "News", "Style", "Sports","Opinion"] def index @listArticles = getListArticles @mainStory = Article.find_articles_to_be_posted.reverse[0] @secondaryStory = Article.find_articles_to_be_posted.reverse[1] end def view ...
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 => '_bluegold_s...
Ruby
class BlogAdminController < ApplicationController scaffold :blog end
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 AddTimestamp < ActiveRecord::Migration def self.up add_column :articles, :created_at, :timestamp end def self.down remove_column :articles, :created_at end end
Ruby
class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.column :title, :string t.column :author, :string t.column :body, :text t.column :image_url, :string end end def self.down drop_table :articles ...
Ruby
class AddSection < ActiveRecord::Migration def self.up add_column :articles, :section, :string end def self.down remove_column :articles, :section end end
Ruby
class AddMainStory < ActiveRecord::Migration def self.up add_column :articles, :main_article, :boolean end def self.down remove_columns :articles, :main_article end end
Ruby
class CreateBlogs < ActiveRecord::Migration def self.up create_table :blogs do |t| t.column :title, :string t.column :description,:text t.column :blog_loc, :string end end def self.down drop_table :blogs end end
Ruby
class AddTestData < ActiveRecord::Migration def self.up Article.delete_all Article.create(:title => 'Call of Duty ROCKS', :author => 'Danny Cellucci', :body =>%{<p>This is like the most amazing game ever! Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra g...
Ruby
#!/usr/local/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 impai...
Ruby
#!/usr/local/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 impai...
Ruby
#!/usr/local/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.lo...
Ruby
#!/usr/local/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 impai...
Ruby
#!/usr/local/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 impai...
Ruby
#!/usr/local/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.lo...
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
# 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
# Be sure to restart your server when you modify this file. # 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. ActiveReco...
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
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying do debug a probl...
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 # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
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