code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: action.rb,v 1.5 2005/05/24 22:19:42 austin Exp $
#++
# An action object, used to... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: catalog.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# Define the document cata... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: procset.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# The document Procedure S... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: fontencoding.rb,v 1.4 2005/06/28 21:32:17 austin Exp $
#++
# The font encoding
c... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: fontdescriptor.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# A font descriptor... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: annotation.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# An annotation object,... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: pages.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
# object which is a parent t... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: en.rb,v 1.9.2.1 2005/08/25 03:38:06 austin Exp $
#++
# PDF::Writer::Lang::EN is ... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: oreader.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
module PDF::Writer::OffsetRe... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# This file is also licensed under standard Ruby licensing provisions: the
# ... | Ruby |
#! /usr/bin/env ruby
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: techbook.rb,v 1.17.2.1 2005/08/25 03:38:05 austin Exp $
#++
r... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: stddev.rb,v 1.9.2.2 2005/09/07 17:01:14 austin Exp $
#++
require 'pdf/writer'
requ... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: quickref.rb,v 1.10.2.3 2005/09/07 17:01:14 austin Exp $
#++
require 'pdf/simpletab... | Ruby |
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: math.rb,v 1.3 2005/05/16 20:44:34 austin Exp $
#++
# Encapsulate some of the mat... | Ruby |
#! /usr/bin/env ruby
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: techbook.rb,v 1.17.2.1 2005/08/25 03:38:05 austin Exp $
#++
r... | Ruby |
# Created by Jamie Hardt on 2006-06-27.
# Copyright (c) 2006. All rights reserved.
class String
# Conatenates a File::SEPARATOR to the end of the receiver and then adds the string argument.
def /(str)
self + File::SEPARATOR + str
end
end | Ruby |
# track.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later v... | Ruby |
# session.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later... | Ruby |
# region.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: metallic.rb,v 1.1 2005/08/05 23:07:20 austin Exp $
#++
# This namespace contains some RGB metallic colours suggested by Jim Freeze.
module Color::RGB::Metallic
... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: yiq.rb,v 1.3 2005/08/08 02:44:17 austin Exp $
#++
# A colour object representing YIQ (NTSC) colour encoding.
class Color::YIQ
# Creates a YIQ colour object fr... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: grayscale.rb,v 1.3 2005/08/08 02:44:17 austin Exp $
#++
# A colour object representing shades of grey. Used primarily in PDF
# document creation.
class Color::G... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: rgb-colors.rb,v 1.1 2005/08/05 23:07:20 austin Exp $
#++
class Color::RGB
AliceBlue = Color::RGB.new(0xf0, 0xf8, 0xff).freeze
AntiqueWhite ... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: cmyk.rb,v 1.5 2005/08/08 02:44:17 austin Exp $
#++
# An CMYK colour object. CMYK (cyan, magenta, yellow, and black) colours
# are based on additive percentages ... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: css.rb,v 1.1 2005/08/05 23:07:20 austin Exp $
#++
require 'color'
# This namespace contains some CSS colour names.
module Color::CSS
# Returns the RGB colour... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: gimp.rb,v 1.3 2005/08/08 02:44:17 austin Exp $
#++
require 'color/palette'
# A class that can read a GIMP (GNU Image Manipulation Program) palette
# file and p... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: monocontrast.rb,v 1.3 2005/08/08 02:44:17 austin Exp $
#++
require 'color/palette'
# Generates a monochromatic constrasting colour palette for background and
#... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: palette.rb,v 1.2 2005/08/05 23:07:20 austin Exp $
#++
require 'color'
module Color::Palette
end
| Ruby |
# blender.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later... | Ruby |
# tag_interpreter.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... | Ruby |
#--
# Colour management with Ruby.
#
# Copyright 2005 Austin Ziegler
# http://rubyforge.org/ruby-pdf/
#
# Licensed under a MIT-style licence.
#
# $Id: color.rb,v 1.8 2005/08/08 02:44:17 austin Exp $
#++
# = Colour Management with Ruby
#
# == Copyright
# Copyright 2005 by Austin Ziegler
#
# Color::RGB and Color::CM... | Ruby |
# pdf_qs.rb
# Author:: Jamie Hardt
#
# This file is part of "agent-orange".
#
# "agent-orange" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ... | Ruby |
#--
# Transaction::Simple
# Simple object transaction support for Ruby
# http://rubyforge.org/projects/trans-simple/
# Version 1.4.0
#
# Licensed under a MIT-style licence. See Licence.txt in the main
# distribution for full licensing information.
#
# Copyright (c) 2003 - 2007 Austin Ziegler
#
# $Id: threadsafe.rb 50... | Ruby |
#--
# Transaction::Simple
# Simple object transaction support for Ruby
# http://rubyforge.org/projects/trans-simple/
# Version 1.4.0
#
# Licensed under a MIT-style licence. See Licence.txt in the main
# distribution for full licensing information.
#
# Copyright (c) 2003 - 2007 Austin Ziegler
#
# $Id: group.rb 47 2007... | Ruby |
#--
# Transaction::Simple
# Simple object transaction support for Ruby
# http://rubyforge.org/projects/trans-simple/
# Version 1.4.0
#
# Licensed under a MIT-style licence. See Licence.txt in the main
# distribution for full licensing information.
#
# Copyright (c) 2003 - 2007 Austin Ziegler
#
# $Id: group.rb 47 2007... | Ruby |
# :title: Transaction::Simple -- Active Object Transaction Support for Ruby
# :main: Readme.txt
#--
# Transaction::Simple
# Simple object transaction support for Ruby
# http://rubyforge.org/projects/trans-simple/
# Version 1.4.0
#
# Licensed under a MIT-style licence. See Licence.txt in the main
# distribution for f... | 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.
# 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 the integrity of signed cookies.
# If you change this key, all old signed cookies 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 attac... | Ruby |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
AgitpropNet::Application.config.session_store :cookie_store, key: '_agitprop-net_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with... | 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 to debug a probl... | Ruby |
AgitpropNet::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.ac... | Ruby |
AgitpropNet::Application.configure do
# Settings specified here will take precedence over those in config/application.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 w... | Ruby |
AgitpropNet::Application.configure do
# Settings specified here will take precedence over those in config/application.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 t... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
AgitpropNet::Application.initialize!
| Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.requir... | Ruby |
AgitpropNet::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'p... | Ruby |
module ApplicationHelper
end
| Ruby |
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__)
AgitpropNet::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 |
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# 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.1.0"
gem 'coffee-rails', "~... | 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 AgitpropNet::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 |
require 'rake'
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/**/*.rb']
t.verbose = true
end
desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_opts = ['--options', "\"spec/spec.opts\""]
t.spec_fil... | Ruby |
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
require 'spec' | Ruby |
class VendingMachine
end
| Ruby |
require 'rubygems'
require 'rake/clean'
$compiler='gcc'
$goal="agilelamp"
SRC = FileList['*.cpp']
OBJ = SRC.ext('o')
CLEAN.include(['*.o', '*.a'])
CLOBBER.include("build/*")
task :default => [$goal]
rule '.o' => ['.cpp'] do |t|
sh "#{$compiler} -c -o #{t.name} #{t.source}"
end
file $goal => OBJ do
sh "#{$comp... | 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
# 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 |
module Rails
class Configuration
def database_configuration
require 'erb'
conf = YAML::load(ERB.new(IO.read(database_configuration_file)).result)
if defined?(TAR2RUBYSCRIPT)
conf.each do |k, v|
if v["adapter"] =~ /^sqlite3/
v["database"] = oldlocation(v["database"])... | 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 :pageants do |pageant|
pageant.resources :rounds, :member => {:report => :get}, :collection => { :sort => :post }
pageant.resources :contestants, :collection => { :sort => :post }
pageant.resources :judges, :member => {:record_scores => :get, :... | Ruby |
at_exit do
require "irb"
require "drb/acl"
require "sqlite3"
end
load "script/server" | Ruby |
pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom - 25] do
pdf.stroke_horizontal_rule
pdf.text "Page #{pdf.page_count()}", :size => 12, :align=>:center
end
pdf.text @title, :size=>14, :align=>:center
pdf.text "#{Time.now.to_s}", :size=>8, :align=>:center... | Ruby |
pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom - 25] do
pdf.stroke_horizontal_rule
pdf.text "Page #{pdf.page_count()}", :size => 12, :align=>:center
end
pdf.text @title, :size=>14, :align=>:center
pdf.text "#{Time.now.to_s}", :size=>8, :align=>:center... | Ruby |
pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom - 25] do
pdf.stroke_horizontal_rule
pdf.text "Page #{pdf.page_count()}", :size => 12, :align=>:center
end
pdf.text @title, :size=>14, :align=>:center
pdf.text "#{Time.now.to_s}", :size=>8, :align=>:center... | Ruby |
pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom - 25] do
pdf.stroke_horizontal_rule
pdf.text "Page #{pdf.page_count()}", :size => 12, :align=>:center
end
pdf.text @title, :size=>14, :align=>:center
pdf.text "#{Time.now.to_s}", :size=>8, :align=>:center... | Ruby |
module AdminHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module PageantsHelper
end
| Ruby |
module ContestHelper
end
| Ruby |
module ScoresHelper
end
| Ruby |
module JudgesHelper
end
| Ruby |
module RoundsHelper
end
| Ruby |
module ContestantsHelper
end
| Ruby |
class Pageant < ActiveRecord::Base
has_many :rounds, :order => "position", :dependent => :destroy
has_many :contestants, :order => "position", :dependent => :destroy
has_many :judges, :dependent => :destroy
has_many :scores, :dependent => :destroy
validates_presence_of :title
validates_uniqueness_of :title... | Ruby |
class Score < ActiveRecord::Base
belongs_to :contestant
belongs_to :judge
belongs_to :round
belongs_to :pageant
validates_presence_of :value, :contestant_id, :round_id
# :judge_id is not included above to allow for scores in manual rounds.
validate :value_less_than_max
validate :value_numericality_by... | Ruby |
class Admin < ActiveRecord::Base
attr_accessor :password_confirmation
validates_confirmation_of :password
validate :password_non_blank
def password
@password
end
def password=(pwd)
@password = pwd
return if pwd.blank?
create_new_salt
self.hashed_password = Admin.encrypted_passw... | Ruby |
class Contestant < ActiveRecord::Base
has_many :scores, :dependent => :destroy
belongs_to :pageant
validates_presence_of :name
acts_as_list :scope => 'pageant_id = #{pageant_id}'
end
| Ruby |
class Judge < ActiveRecord::Base
has_many :scores, :dependent => :destroy
belongs_to :pageant
validates_presence_of :username, :alias, :name
validates_uniqueness_of :username, :alias
attr_accessor :password_confirmation
validates_confirmation_of :password
validate :password_non_blank
validate :... | Ruby |
class Round < ActiveRecord::Base
has_many :scores, :dependent => :destroy
belongs_to :pageant
validates_presence_of :description, :max_score, :abbreviation
validates_length_of :abbreviation, :maximum=>4
validates_numericality_of :max_score, :greater_than => 0
acts_as_list :scope => 'pageant_id = #{p... | Ruby |
class AdminsController < ApplicationController
def login
if Admin.find(:all).empty?
redirect_to new_admin_url
end
session[:judge_id] = nil
if request.post?
if (params[:username]=="admin")
admin = Admin.authenticate(params[:password])
if admin
session[:judge_id... | Ruby |
class ScoresController < ApplicationController
layout "default", :except => [ :report, :simple_report ]
skip_before_filter :authorize_admin, :only => [:add_score, :lock_scores, :find_pageant]
before_filter :authorize_judge_or_admin, :only => [:add_score, :lock_scores, :find_pageant]
before_filter :find_pagea... | Ruby |
class PageantsController < ApplicationController
def index
@pageants = Pageant.all
redirect_to(@pageants.first) if not @pageants.empty?
end
def show
@pageants = Pageant.all
@pageant = Pageant.find(params[:id])
end
def new
@pageant = Pageant.new
end
def edit
@pageant = Pageant... | Ruby |
class JudgesController < ApplicationController
layout "default", :except => [ :report ]
skip_before_filter :authorize_admin, :only => [:record_scores]
before_filter :find_pageant
before_filter :authorize_judge_or_admin, :only => [:record_scores]
def show
@judge = @pageant.judges.find(params[:id])
@ro... | Ruby |
class AdminController < ApplicationController
def login
session[:judge_id] = nil
if request.post?
if (params[:username]=="admin" and params[:password]=="awesome")
session[:judge_id] = 'admin'
redirect_to(:controller=>'judges')
else
judge = Judge.authenticate(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
layout "default"
before_filter :authorize_admin, :except => [:login, :logout, :new, :create]
helper :all... | Ruby |
class RoundsController < ApplicationController
layout "default", :except => [ :report ]
before_filter :find_pageant
def show
@round = @pageant.rounds.find(params[:id])
@contestants = @pageant.contestants.find(:all, :order=>"position")
@judges = @pageant.judges.find(:all, :order=>"alias")
@roun... | Ruby |
class ContestantsController < ApplicationController
before_filter :find_pageant
def show
@contestant = @pageant.contestants.find(params[:id])
@rounds = @pageant.rounds.find(:all, :order=>'position')
@judges = @pageant.judges.find(:all, :order=>'alias')
@ranking = Score.rankings(@pageant)[@contes... | 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/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.