code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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 CreatePages < ActiveRecord::Migration
def self.up
create_table :pages do |t|
end
end
def self.down
drop_table :pages
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
end
end
def self.down
drop_table :users
end
end
| Ruby |
class CreateIntwords < ActiveRecord::Migration
def self.up
create_table :intwords do |t|
end
end
def self.down
drop_table :intwords
end
end
| Ruby |
class CreateWords < ActiveRecord::Migration
def self.up
create_table :words do |t|
end
end
def self.down
drop_table :words
end
end
| Ruby |
class CreateKinds < ActiveRecord::Migration
def self.up
create_table :kinds do |t|
end
end
def self.down
drop_table :kinds
end
end
| Ruby |
class CreateSources < ActiveRecord::Migration
def self.up
create_table :sources do |t|
end
end
def self.down
drop_table :sources
end
end
| Ruby |
#!/usr/bin/ruby1.8
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 |
#!/usr/bin/ruby1.8
#
# 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 |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
environment = :production
output_style = :compressed | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css-debug")
environment = :development
output_style = :expanded | Ruby |
# This file registers the sencha-touch framework with compass
# It's a magic name that compass knows how to find.
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'theme_images.rb')
# Include compass-recipes
require File.join(File.dirname(__FILE__), 'vendor', 'compass-recipes', 'config')
Compass::BrowserSup... | Ruby |
stylesheet 'sencha-touch.scss' | Ruby |
module SenchaTouch
module SassExtensions
module Functions
module ThemeImages
def theme_image(theme, path, mime_type = nil)
path = path.value
images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value)
real_path = File.join(images_path, path)
i... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | 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 |
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 |
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 |
#!/usr/bin/ruby
if ARGV.length < 3
puts "Error: Missing arguments."
puts "<server ip> <port> <rcon password>"
puts "Only use IP addresses, no domain names."
puts "Eg: ./check.rb 192.168.0.11 27015 ch33s3"
exit
end
$argv_server_ip = ARGV[0]
$argv_server_port = ARGV[1]
$argv_server_rcon = ARGV[2]
require 'rubygem... | Ruby |
#!/usr/bin/ruby
if ARGV.length < 3
puts "Error: Missing arguments."
puts "<server ip> <port> <rcon password>"
puts "Only use IP addresses, no domain names."
puts "Eg: ./check.rb 192.168.0.11 27015 ch33s3"
exit
end
$argv_server_ip = ARGV[0]
$argv_server_port = ARGV[1]
$argv_server_rcon = ARGV[2]
require 'rubygem... | 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|
map.resources :pictures
map.resources :rating_submitteds
map.resources :ratings
map.resources :grade_entries
map.resources :assignemnts
map.resources :course_materials
map.resources :announcements
map.resources :courses
map.resources :class_stand... | Ruby |
module SyllabusHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module ContactsHelper
end
| Ruby |
module MajorsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module CourseMaterialsHelper
end
| Ruby |
module HomeHelper
end
| Ruby |
module ClassStandingsHelper
end
| Ruby |
module RatingsHelper
end
| Ruby |
module GradeEntriesHelper
end
| Ruby |
module PeopleHelper
end
| Ruby |
module ScheduleHelper
end
| Ruby |
module CommunicationsHelper
end
| Ruby |
module RateHelper
end
| Ruby |
module AnnouncementsHelper
end
| Ruby |
module CoursesHelper
end
| Ruby |
module ForgottenHelper
end
| Ruby |
module DashboardHelper
end
| Ruby |
module MaterialsHelper
end
| Ruby |
module LoginHelper
end
| Ruby |
module AssignemntsHelper
end
| Ruby |
module SettingsHelper
end
| Ruby |
module RatingSubmittedsHelper
end
| Ruby |
module GradesHelper
end
| Ruby |
module RolesHelper
end
| Ruby |
class GradeEntry < ActiveRecord::Base
validates_presence_of :person_id, :assignment_id, :grade
validates_numericality_of :person_id, :assignment_id, :grade
#errors.add(:grade, "Not a valid Grade") if :grade.nil? || :grade < 0.0
has_many :persons
has_many :assignments
def self.get_student_... | Ruby |
class Announcement < ActiveRecord::Base
validates_presence_of :content
protected
def self.find_all_announcements
find(:all, :order => "created_at DESC")
end
end
| Ruby |
class ClassStanding < ActiveRecord::Base
validates_presence_of :standing
#validates_numericality_of :standing
belongs_to :person
end
| Ruby |
class Contact < ActiveRecord::Base
validates_presence_of :email
#belongs_to :person
end
| Ruby |
class User < ActiveRecord::Base
validates_presence_of :username, :password, :role
validates_numericality_of :role
#has_one :role
protected
def self.find_all_users
find(:all, :order => "username")
end
end
| Ruby |
class RatingSubmitted < ActiveRecord::Base
validates_presence_of :person_id
validates_numericality_of :person_id
def self.showRateSubmitteds()
result = ""
@rates = Person.find_by_sql("select p.* from people p, rating_submitteds r where r.person_id = p.id order by p.surname")
... | Ruby |
class Role < ActiveRecord::Base
validates_presence_of :description
#belongs_to :user
end
| Ruby |
class Rating < ActiveRecord::Base
validates_presence_of :performance, :improvement, :hours
validates_numericality_of :hours
# errors.add(:hours, "Not valid: hours must be greater than zero") if :hours.nil? || :hours < 0.0
def self.showRates()
result = ""
@rates = find(:all, :order => "crea... | Ruby |
class Major < ActiveRecord::Base
validates_presence_of :name
belongs_to :person
end
| Ruby |
class MessageMailer < ActionMailer::Base
# to_addrs is an array of strings of email addresses to send to, from_user is a User object
# subject_line is a string that is the subject of the email
def send(to_addrs, from_user, subject_line, message)
subject subject_line
recipients to_addrs
from from_use... | Ruby |
class Assignemnt < ActiveRecord::Base
validates_presence_of :title, :points_possible
validates_numericality_of :points_possible
#errors.add(:points_possible, "Not valid: points_possible must be greater than zero") if points_possible.nil? || points_possible < 0
belongs_to :grade_entry
protected... | Ruby |
class Course < ActiveRecord::Base
validates_presence_of :name, :logo_url, :term, :scheduled_time, :syllabus_url, :schedule_url
validates_uniqueness_of :name
validates_format_of :logo_url,
:with => %r{\.(gif|jpg|png|bmp)$}i,
:message => "must be a URL for a GIF, JPG, BMP, or PNG image"
va... | Ruby |
class CourseMaterial < ActiveRecord::Base
#validates_presence_of :title
def uploaded_document=(document_field)
self.filename = base_part_of(document_field.original_filename)
#self.title = "my title"
#self.document_url = "some url"
self.content_type = document_fie... | Ruby |
class Person < ActiveRecord::Base
validates_presence_of :user, :surname, :firstname
#validates_numericality_of :age, :class_standing, :major
#errors.add(:age, "Not a valid age") if age.nil? || age < 0
#errors.add(:gender, "Not a valid gender") if gender.nil? || !(gender == "male" || gender == "female")
... | Ruby |
class CoursesController < ApplicationController
# GET /courses
# GET /courses.xml
def index
@courses = Course.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @courses }
end
end
# GET /courses/1
# GET /courses/1.xml
def show
@course ... | Ruby |
class ForgottenController < ApplicationController
def index
end
def sendMessage
if params[:email] == ''
flash[:notice] = "No email address was entered"
render :action => :index
return
end
to_contact = Contact.find(:first, :conditions => ["email = ?", params[:email]])
if not to_contact.nil?
... | Ruby |
class HomeController < ApplicationController
def index
if authorize
@listing = Announcement.find_all_announcements
@course = Course.find_course
if session[:loginrole] == "Admin"
@dashboard = "Go to Gradebook"
end
@course_material = CourseMaterial.find(:first, :... | Ruby |
class SettingsController < ApplicationController
def index
if authorize
if session[:loginrole] == "Admin"
@dashboard = "Go to Gradebook"
end
@username = session[:loginname]
user = User.find(:first, :conditions => [ "username = ?", @username])
... | Ruby |
class CourseMaterialsController < ApplicationController
# GET /course_materials
# GET /course_materials.xml
def index
@course_materials = CourseMaterial.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @course_materials }
end
end
# GET /cour... | Ruby |
class RolesController < ApplicationController
# GET /roles
# GET /roles.xml
def index
@roles = Role.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @roles }
end
end
# GET /roles/1
# GET /roles/1.xml
def show
@role = Role.find(params... | Ruby |
class GradesController < ApplicationController
def index
if authorize
@total_score = 0
@assignments = Assignemnt.find_all_assignemnts()
@studentgrades = {}
@assignments.each {|assignment|
grade_entry = GradeEntry.get_student_grades(Person.find_by_username(session[:loginname]).i... | Ruby |
class ScheduleController < ApplicationController
def index
if authorize
#@course = Course.find_course
if session[:loginrole] == "Admin"
@dashboard = "Go to Gradebook"
end
@course_material = CourseMaterial.find(:first, :conditions => ["doc_type = 2"])
end
end
... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.