code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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 ProfileHelper
end
| Ruby |
module ElectionHelper
def display_election_item(item, user, election)
return display_rating(item, user, election) if election.is_a?(RatingElection)
end
def display_rating(item, user, election)
vote = Vote.find_by_item_id_and_person_id_and_election_id(item.id, user.id, election.id)
selected = 0
... | Ruby |
module LoginHelper
end
| Ruby |
module AdminHelper
end
| Ruby |
module ConferenceHelper
end
| Ruby |
class Presentation < Item
def presenters
people = []
self.participants.each do | part |
people << part.person if part.role.downcase == "presenter"
end
return people
end
end
| Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
class RatingElection < Election
end
| Ruby |
class Conference < ActiveRecord::Base
has_many :events
end
| Ruby |
class Person < ActiveRecord::Base
has_many :votes
has_many :participants
def last_first
name = "#{self.last_name}, #{self.first_name}"
name << " #{self.middle_name}" unless self.middle_name.blank?
return name
end
def full_display
name = self.first_name
name << " #{self.middle_name}" ... | Ruby |
class Event < ActiveRecord::Base
belongs_to :conference
has_many :items
has_many :elections
end
| Ruby |
class TShirtProposal < Item
end
| Ruby |
class Item < ActiveRecord::Base
belongs_to :event
has_many :votes
has_many :participants, :dependent => :destroy
@@children = []
def self.inherited(sub)
@@children << sub
end
def self.children
return @@children
end
def has_role?(person, role)
self.participants.each do | part |
... | Ruby |
class Vote < ActiveRecord::Base
belongs_to :election
belongs_to :person
belongs_to :item
end
| Ruby |
class Participant < ActiveRecord::Base
belongs_to :person
belongs_to :item
end
| Ruby |
class LocationProposal < Item
end
| Ruby |
class KeynoteProposal < Item
end
| Ruby |
class Election < ActiveRecord::Base
belongs_to :event
has_many :votes
@@children = []
def self.inherited(sub)
@@children << sub
end
def self.children
return @@children
end
def open?
right_now = Time.now
return true if right_now >= self.start_time && right_now <= self.end_time
... | Ruby |
class LoginController < ApplicationController
layout 'layouts/standard_layout'
def index
end
def error
flash[:notice] = "Invalid username or password"
end
def login
svcs = YAML.load_file("#{RAILS_ROOT}/config/services.yml")
client = DrupalClient.new(svcs["Drupal"]["host"], params[:use... | 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 => '_Conference... | Ruby |
class ElectionController < ApplicationController
layout 'layouts/standard_layout'
def index
unless params[:id]
redirect_to :action=>"list_elections"
return
end
@election = Election.find(params[:id])
@page_title = "Election: #{@election.name}"
@page_title = @election.name
@event ... | Ruby |
class ProfileController < ApplicationController
layout 'layouts/standard_layout'
def index
@person = Person.find_by_username(session[:username])
end
def edit
unless params[:id]
@person = (Person.find_by_username(session[:username])||Person.new)
else
@person = Person.find(params[:id])
... | Ruby |
class AdminController < ApplicationController
layout "layouts/admin_layout"
auto_complete_for :person, :last_first
def index
redirect_to :action=>"menu" if session[:event_id]
@conferences = Conference.find(:all)
end
def menu
end
def set_event_id
session[:event_id] = params[:id]
... | Ruby |
class ConferenceController < ApplicationController
layout "layouts/standard_layout"
def index
unless params[:id]
redirect_to :action=>"list_conferences"
return
end
@conf = Conference.find(params[:id])
@page_title = "#{@conf.name} Home"
end
def events
unless params[:id]
r... | 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
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
unless defined?(Rails::Initializer)
if File.directory?("#{RAILS_ROOT}/vendor/rails")
require "#{RAILS_ROOT}/vendor/rails/railties/lib/init... | 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 |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
class DrupalClient
def initialize(host, username, password)
@host = host
@username = username
@password = password
@uri = URI.parse(@host)
end
def login
res = Net::HTTP.post_form(@uri,{'edi... | Ruby |
source "http://rubygems.org"
gem 'sinatra'
gem 'haml'
gem 'activerecord'
gem 'rack-conneg'
gem 'rdiscount'
gem 'json'
gem 'mysql' | Ruby |
class Conference < ActiveRecord::Base
has_many :events
end
class Election < ActiveRecord::Base
belongs_to :event
has_many :votes
# @@children = []
#
# def self.inherited(sub)
# @@children << sub
# end
#
# def self.children
# return @@children
# end
def open?
right_now = Time.now
... | Ruby |
require 'net/http'
class DrupalClient
def initialize(host, username, password)
@host = host
@username = username
@password = password
@uri = URI.parse(@host)
end
def login
res = Net::HTTP.post_form(@uri,{'edit[name]'=>@username,
'edit[pass]'=>@password,'edit[form_id]'=>'user_logi... | Ruby |
$KCODE = 'u'
require 'rubygems'
require 'jcode'
require 'sinatra'
require 'haml'
require 'active_record'
require 'yaml'
require 'rack/conneg'
require 'lib/models'
require 'lib/drupal_client'
require 'rdiscount'
require 'json'
configure do
CONFIG = YAML.load_file('config/config.yml')
ActiveRecord::Base.establish_co... | Ruby |
class CreateConferences < ActiveRecord::Migration
def self.up
create_table :conferences do |t|
t.column "name", :string, :limit => 100, :null => false
end
end
def self.down
drop_table :conferences
end
end
| Ruby |
class CreatePeople < ActiveRecord::Migration
def self.up
create_table :people do |t|
t.column "username", :string, :limit => 50
t.column "first_name", :string, :limit => 100
t.column "middle_name", :string, :limit => 100
t.column "last_name", :string, :limit => 100
t.column "email", ... | Ruby |
class CreateParticipants < ActiveRecord::Migration
def self.up
create_table :participants do |t|
t.column "person_id", :integer, :null => false
t.column "item_id", :integer, :null => false
t.column "role", :string, :limit => 25
end
add_index "participants", ["person_id", "item_id",... | Ruby |
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events do |t|
t.column "name", :string, :limit => 100, :null => false
t.column "conference_id", :integer, :null => false
t.column "location", :string, :limit => 255
t.column "start_time", :datetime
t.column "end_t... | Ruby |
class AddSessions < ActiveRecord::Migration
def self.up
create_table :sessions do |t|
t.column :session_id, :string
t.column :data, :text
t.column :updated_at, :datetime
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
def self.down
drop_table :sess... | Ruby |
class CreateElections < ActiveRecord::Migration
def self.up
create_table :elections do |t|
t.column "event_id", :integer, :null => false
t.column "name", :string, :limit => 255
t.column "type", :string, :limit => 50
t.column "conditions", :text
t.column "start_time", :datetime
... | Ruby |
class CreateItems < ActiveRecord::Migration
def self.up
create_table :items do |t|
t.column "name", :string, :limit => 255, :null => false
t.column "event_id", :integer, :null => false
t.column "description", :text
t.column "type", :string, :limit => 50, :null => false
t.column "star... | Ruby |
class CreateVotes < ActiveRecord::Migration
def self.up
create_table :votes do |t|
t.column "election_id", :integer, :null => false
t.column "person_id", :integer, :null => false
t.column "item_id", :integer, :null => false
t.column "score", :integer, :null => false, :default => 1
t.... | 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 |
#!/sw/jruby/bin/jruby
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 |
#!/sw/jruby/bin/jruby
#
# 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 |
#!/sw/jruby/bin/jruby
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 |
#!/sw/jruby/bin/jruby
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 |
#!/sw/jruby/bin/jruby
#
# 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 |
#!/sw/jruby/bin/jruby
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/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 ProfileHelper
end
| Ruby |
module ElectionHelper
def display_election_item(item, user, election)
return display_rating(item, user, election) if election.is_a?(RatingElection)
end
def display_rating(item, user, election)
vote = Vote.find_by_item_id_and_person_id_and_election_id(item.id, user.id, election.id)
selected = 0
... | Ruby |
module LoginHelper
end
| Ruby |
module AdminHelper
end
| Ruby |
module ConferenceHelper
end
| Ruby |
class Presentation < Item
def presenters
people = []
self.participants.each do | part |
people << part.person if part.role.downcase == "presenter"
end
return people
end
end
| Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
class RatingElection < Election
end
| Ruby |
class Conference < ActiveRecord::Base
has_many :events
end
| Ruby |
class Person < ActiveRecord::Base
has_many :votes
has_many :participants
def last_first
name = "#{self.last_name}, #{self.first_name}"
name << " #{self.middle_name}" unless self.middle_name.blank?
return name
end
def full_display
name = self.first_name
name << " #{self.middle_name}" ... | Ruby |
class Event < ActiveRecord::Base
belongs_to :conference
has_many :items
has_many :elections
end
| Ruby |
class TShirtProposal < Item
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.