code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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
#!/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' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateKeyvalues < ActiveRecord::Migration def self.up create_table :keyvalues do |t| t.string :key t.string :value t.references :ping t.timestamps end end def self.down drop_table :keyvalues end end
Ruby
class BaseMigration < ActiveRecord::Migration def self.up create_table "phones", :force => true do |t| t.string "name" t.integer "home_ping_id" t.integer "area_code_ping" t.datetime "created_at" t.datetime "updated_at" t.string "number" end create_table "pings", ...
Ruby
class CreateMessageParts < ActiveRecord::Migration def self.up create_table :message_parts do |t| # Meta Data Fields for Message Part t.string "form_id" t.integer "current_part" t.integer "total_parts" t.string "payload" t.boolean "processed" # Fields from ping.rb - Use...
Ruby
class CreateTiles < ActiveRecord::Migration def self.up create_table :tiles do |t| t.timestamps end end def self.down drop_table :tiles end end
Ruby
class CreateCrsForms < ActiveRecord::Migration def self.up create_table :crs_forms do |t| t.string "form_id" # Fields from ping.rb - Used for Geocoding t.string "content" t.string "address" t.string "country" t.string "locality" t.string "thoroughfare" t.s...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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 Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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 Fast...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
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' }]) # Major.create(:name...
Ruby
class CreateScheduledItems < ActiveRecord::Migration def self.up create_table :scheduled_items do |t| t.references :schedule t.references :event t.timestamps end end def self.down drop_table :scheduled_items end end
Ruby
class CreateSchedules < ActiveRecord::Migration def self.up create_table :schedules do |t| t.references :user t.timestamps end end def self.down drop_table :schedules end end
Ruby
class CreateInstructors < ActiveRecord::Migration def self.up create_table :instructors do |t| t.string :first_name t.string :last_name t.string :url t.timestamps end end def self.down drop_table :instructors end end
Ruby
class AddDepartmentToInstructors < ActiveRecord::Migration def self.up add_column :instructors,:department,:string end def self.down remove_column :instructors,:department end end
Ruby
class AddSubtitleToEvent < ActiveRecord::Migration def self.up add_column :events, :subtitle, :string end def self.down remove_column :events, :subtitle end end
Ruby
class AddCourseTitle < ActiveRecord::Migration def self.up add_column :courses,:title,:string end def self.down remove_column :courses,:title end end
Ruby
class CreateTerms < ActiveRecord::Migration def self.up create_table :terms do |t| t.datetime :start_date t.datetime :end_date t.string :name t.timestamps end end def self.down drop_table :terms end end
Ruby
class ChangeTeachingsFieldsToFloats < ActiveRecord::Migration def self.up remove_column :teachings,:usefulness remove_column :teachings,:effectiveness add_column :teachings,:usefulness,:float add_column :teachings,:effectiveness,:float end def self.down remove_column :teachings,:usefulness ...
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table "users", :force => true do |t| t.column :login, :string, :limit => 40 t.column :name, :string, :limit => 100, :default => '', :null => true t.column :email, :string, ...
Ruby
class CreateTeachings < ActiveRecord::Migration def self.up create_table :teachings do |t| t.references :lecture t.references :instructor t.integer :usefulness t.integer :effectiveness t.timestamps end end def self.down drop_table :teachings end end
Ruby
class AddIsPrimaryToEvent < ActiveRecord::Migration def self.up add_column :events, :is_primary, :boolean end def self.down remove_column :events, :is_primary end end
Ruby
class AddDiscussionNumbers < ActiveRecord::Migration def self.up add_column :events,:section_number,:string end def self.down remove_column :events,:section_number end end
Ruby
class CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.string :type t.string :event_name t.string :event_type t.string :location t.time :start_time t.time :stop_time t.boolean :monday t.boolean :tuesday t.boolean :wednesday ...
Ruby
class CreateDepartmentAbbreviations < ActiveRecord::Migration def self.up create_table :department_abbreviations do |t| t.string :abbreviation t.string :department t.timestamps end end def self.down drop_table :department_abbreviations end end
Ruby
class ChangeUnitsToFloatInCourse < ActiveRecord::Migration def self.up change_column :courses, :units, :float end def self.down change_column :courses, :units, :integer end end
Ruby
class AddUnitsToCourses < ActiveRecord::Migration def self.up add_column :courses,:units,:integer end def self.down remove_column :courses,:units end end
Ruby
class CreateCourses < ActiveRecord::Migration def self.up create_table :courses do |t| t.string :department t.string :course_number t.references :term t.string :description t.timestamps end end def self.down drop_table :courses end end
Ruby
class RenameLectureIdInTeachings < ActiveRecord::Migration def self.up rename_column :teachings, :lecture_id, :event_id end def self.down rename_column :teachings, :event_id, :lecture_id end end
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
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy' # remove this line to skip loading any of the default tasks
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV['RSPEC'] = 'true' # allows autotest to discover rspec ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || $stderr.puts("Unable to find auto...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby begin load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber") rescue LoadError => e raise unless e.to_s =~ /cucumber/ require 'rubygems' require 'cucumber' load Cucumber::BINARY end
Ruby
#!/usr/bin/env ruby if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} require 'rubygems' unless ENV['NO_RUBYGEMS'] else gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.dirname(__FILE__) + "/../config/enviro...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} require 'rubygems' unless ENV['NO_RUBYGEMS'] else gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.dirname(__FILE__) + "/../config/enviro...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby begin load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber") rescue LoadError => e raise unless e.to_s =~ /cucumber/ require 'rubygems' require 'cucumber' load Cucumber::BINARY end
Ruby
#!/usr/bin/env ruby gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 ENV['RSPEC'] = 'true' # allows autotest to discover rspec ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || $stderr.puts("Unable to find auto...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
require 'spec_helper' describe SearchController do describe "routing" do it "recognizes and generates #index" do { :get => "/" }.should route_to(:controller => "search", :action => "index") end end end
Ruby
# This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] ||= 'test' require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) require 'spec/autorun' require 'spec/rails' # Uncomment the next line to use webrat's matchers...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module EventsHelper end
Ruby
module SessionsHelper end
Ruby
module TeachingsHelper end
Ruby
module TermsHelper end
Ruby
module InstructorsHelper end
Ruby
module UsersHelper # # Use this to wrap view elements that the user can't access. # !! Note: this is an *interface*, not *security* feature !! # You need to do all access control at the controller level. # # Example: # <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> ...
Ruby
module SchedulesHelper end
Ruby
module CoursesHelper end
Ruby
module DepartmentAbbreviationsHelper end
Ruby
class Lab < Event validates_uniqueness_of :ccn end
Ruby
class Commitment < Event belongs_to :user def Commitment.update(myId, myName, myStart, myEnd, isMo, isTu, isWe, isTh, isFr, isSa, isSu) theCommit = Commitment.find(:first, :conditions => {:id => myId}) theCommit.event_name = myName theCommit.start_time = myStart theCommit.stop_time = myEnd th...
Ruby
class Event < ActiveRecord::Base belongs_to :course has_many :scheduled_items, :dependent=>:destroy has_many :teachings has_many :instructors, :through=>:teachings, :dependent=>:destroy validates_presence_of :event_name validates_presence_of :location validates_presence_of :start_time validates_...
Ruby
class Course < ActiveRecord::Base belongs_to :term has_many :lectures, :dependent=>:destroy has_many :discussions, :dependent=>:destroy has_many :labs, :dependent=>:destroy validates_numericality_of :units, :greater_than_or_equal_to => 0, :allow_nil => true validates_numericality_of :term_id, :greater_than ...
Ruby
class Schedule < ActiveRecord::Base # belongs_to :user has_many :scheduled_items, :dependent=>:destroy has_many :events, :through=>:scheduled_items belongs_to :user # TODO: Called in an INSTANCE of schedule so there is a list of events... # build should algorithmically CLOBBER @events with a new list...
Ruby
require 'uri' class Term < ActiveRecord::Base has_many :courses, :dependent=>:destroy validates_uniqueness_of :name,:start_date,:end_date attr_accessor :verboseParsing # Process query with the latest term def query(fields, offset=0, limit=25) fields = fields.dup fields[:term_id] = self.id # ...
Ruby