code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# 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 => '_crosswalk_... | 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 |
#!c:/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" -- otherwise performance is severely impaired... | Ruby |
#!c:/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" -- otherwise performance is severely impaired... | Ruby |
#!c:/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 crash log is RAILS_ROOT/log/fastcgi.crash.log
#... | Ruby |
#!c:/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" -- otherwise performance is severely impaired... | Ruby |
#!c:/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" -- otherwise performance is severely impaired... | Ruby |
#!c:/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 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 |
# 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):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | 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 |
set :application, "crowd-control"
set :repository, "http://crowd-control.googlecode.com/svn/trunk"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"
set :dep... | Ruby |
set :application, "crowd-control"
set :repository, "http://crowd-control.googlecode.com/svn/trunk"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"
set :dep... | 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
# 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
# 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 |
# 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.0... | 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 |
set :application, "crowd-control"
set :repository, "http://crowd-control.googlecode.com/svn/trunk"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"
set :dep... | 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 |
module AdminHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def logged_in_as_manager?
logged_in? && current_user.manager?
end
def render_user(user)
user.render
end
def form_block(&proc)
concat '<table class="form_section">', proc.binding
... | Ruby |
module CallForWorkersHelper
end
| Ruby |
module EventsHelper
def number_of_events_in_state(state)
@event_counts[state].to_i || 0
end
end
| Ruby |
module ProfileHelper
end
| Ruby |
module AccountHelper
include ProfileHelper
end | Ruby |
module InstallHelper
end
| Ruby |
module UserAdminHelper
end
| Ruby |
module CommentsHelper
end
| Ruby |
class CommentMailer < ActionMailer::Base
def comment_notification(comment, recipient)
recipients recipient.email
from RETURN_ADDRESS
subject :comment_posted.localize_with_args(:event => comment.event.name)
host, port = comment.url.split(':')
body :author => comment.user.render, :recipient => re... | Ruby |
require 'yaml'
class Event < ActiveRecord::Base
class InvalidNextState < Exception ; end
has_many :availabilities, :dependent => :destroy
has_many :attendances, :dependent => :destroy
has_many :comments, :dependent => :destroy
validates_presence_of :name
validates_presence_of :description
validates... | Ruby |
class EventMailer < ActionMailer::Base
def cfw(events, recipient, message, host_with_port)
recipients recipient.email
from RETURN_ADDRESS
subject :cfw.l
host, port = host_with_port.split(':')
body :recipient => recipient.salutation, :events => events, :host => host, :port => port || 80, :message =... | Ruby |
class State
attr_accessor :next_states
attr_reader :name
def self.load
@states = []
end
def self.in_order
end
def self.find(name)
end
private
def initialize(name, next_states=[])
@name = name
self.next_states = next_states
end
end | Ruby |
class Attendance < ActiveRecord::Base
belongs_to :event
belongs_to :user
def ==(other)
self.event.id == other.event.id && self.user.id == other.user.id
end
end
| Ruby |
class CallForWorker < ActiveRecord::Base
has_and_belongs_to_many :events
belongs_to :user
has_many :delivery_errors, :dependent => :delete_all
has_many :delivery_successes, :dependent => :delete_all
def record_delivery_success(user)
delivery_successes << DeliverySuccess.new(:user => user, :email => use... | Ruby |
class Admin
def self.users
User
end
def self.call_for_workers
CallForWorker
end
end | Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
attr_accessor :signup_was_completed
attr_accessor :post_signup_url
# Virtual attribute for the unencrypted password
VOWELS = 'aeiou'.split ''
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'.split ''
DIGITS = '1234567890'.split ''
attr_accessor :password
... | Ruby |
class DeliveryError < ActiveRecord::Base
belongs_to :user
end
| Ruby |
class Comment < ActiveRecord::Base
belongs_to :event
belongs_to :user
attr_accessor :url
after_save do |comment|
comment.event.interested_users.each do |u|
CommentMailer.deliver_comment_notification(comment, u)
end
end
end
| Ruby |
class Availability < ActiveRecord::Base
belongs_to :event
belongs_to :user
def ==(other)
self.event.id == other.event.id && self.user.id == other.user.id
end
end
| Ruby |
class DeliverySuccess < ActiveRecord::Base
belongs_to :user
end
| Ruby |
class WelcomeController < ApplicationController
def index
redirect_to :controller => 'events', :action => 'index' if logged_in?
end
def install
return redirect_to(:action => 'index') unless User.no_managers_exist?
@user = User.new
if request.post?
@user = User.new(params[:user])
@us... | Ruby |
class CommentsController < ApplicationController
before_filter :load_event
before_filter :deny_non_attendees, :only => :create
before_filter :deny_non_owners, :only => :destroy
def index
@comments = @event.comments.find(:all, :order => 'created_at asc')
render :layout => false
end
def create
... | Ruby |
class ProfileController < ApplicationController
before_filter :login_required
before_filter :load_user
def update
if @user.update_attributes(@user.filter_attributes(params[:user]))
flash[:notice] = :profile_saved.l
redirect_to :action => 'show'
else
render :action => 'edit'
end
... | Ruby |
class CallForWorkersController < AdminSupportController
resources_controller_for :call_for_workers
before_filter :find_events, :only => [:create, :new]
def print
end
def create
@cfw = CallForWorker.new(params[:cfw])
@cfw.user = current_user
if @cfw.save and @cfw.event_ids = params[:events]... | Ruby |
include ActionController
class EventsController < ApplicationController
before_filter :validate_state, :only => [:index, :choose_for_state_change]
before_filter :manager_required, :except => [:show, :index, :attend, :unattend, :update_availability]
before_filter :login_required
before_filter :load_event_counts,... | Ruby |
class AccountController < ApplicationController
# say something nice, you goof! something sweet.
def index
redirect_to(:action => 'signup') unless logged_in? || User.count > 0
end
def login
return unless request.post?
self.current_user = User.authenticate(params[:login], params[:password])
if... | 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 => '_crowd-cont... | Ruby |
class AdminSupportController < ApplicationController
before_filter :manager_required, :except => :stop_impersonating
before_filter :login_required
map_enclosing_resource :admin, :singleton => true do Admin ; end
end | Ruby |
class UsersController < AdminSupportController
resources_controller_for :users
def before_update(user, params)
unless user.signup_complete?
if params[:signup_complete]
user.signup_was_completed = true
host, port = request.host_with_port.split(":")
user.post_signup_url = url_for(... | 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/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'
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 |
#!/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.