code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
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!
# 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 |
# 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.... | 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 |
# 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 |
require "pdf/simpletable"
class PdfDrawer
def self.draw(org, filepath, bool)
pdf = PDF::Writer.new(:paper => "A4")
#form1------------------
pdf.text "<c:uline>Osa Form 1</c:uline>", :font_size => 10
pdf.text "<c:uline><b>INFORMATION SHEET FOR STUDENT ORGANIZATIONS</b></c:uline>", :justific... | Ruby |
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret, authtype if user or secret
sock = timeout(@open_timeout) { TCPSocket.open(@address, @po... | Ruby |
class CreateAnnouncements < ActiveRecord::Migration
def self.up
create_table :announcements do |t|
t.integer :user_id
t.text :message
t.timestamps
end
end
def self.down
drop_table :announcements
end
end
| Ruby |
class CreateStudents < ActiveRecord::Migration
def self.up
create_table :students do |t|
t.integer :student_no
t.string :name
t.string :degree_program
t.string :gender
t.boolean :enrolled
t.string :webmail
t.timestamps
end
end
def self.down
drop_table :stude... | Ruby |
class CreateDataFiles < ActiveRecord::Migration
def self.up
create_table :data_files do |t|
t.timestamps
end
end
def self.down
drop_table :data_files
end
end
| Ruby |
class CreateAdministrators < ActiveRecord::Migration
def self.up
create_table :administrators do |t|
t.string :name
t.integer :account_id
t.timestamps
end
end
def self.down
drop_table :administrators
end
end
| Ruby |
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events do |t|
t.integer :organization_id
t.string :name
t.string :category
t.text :description
t.date :date
t.string :venue
t.string :event_head
t.text :report
t.timestamps
end
end
... | Ruby |
class CreateAwards < ActiveRecord::Migration
def self.up
create_table :awards do |t|
t.integer :organization_id
t.string :name
t.string :classification
t.text :description
t.string :from
t.timestamps
end
end
def self.down
drop_table :awards
end
end
| Ruby |
class CreateMemberships < ActiveRecord::Migration
def self.up
create_table :memberships do |t|
t.integer :student_id
t.integer :organization_id
t.integer :year
t.timestamps
end
end
def self.down
drop_table :memberships
end
end
| Ruby |
class CreateOrganizations < ActiveRecord::Migration
def self.up
create_table :organizations do |t|
t.string :name
t.string :acronym
t.date :date_established
t.text :description
t.string :tambayan_address
t.string :nature
t.string :category
t.string :mailing_address
... | Ruby |
class CreateOsas < ActiveRecord::Migration
def self.up
create_table :osas do |t|
t.integer :account_id
t.string :name
t.timestamps
end
end
def self.down
drop_table :osas
end
end
| Ruby |
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
#t.integer :user_id
t.string :username
t.string :password
t.string :group
t.timestamps
end
end
def self.down
drop_table :accounts
end
end
| 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 |
#!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 |
#!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 |
#!/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/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/console'
| 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'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
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/dbconsole'
| 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/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/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/request'
| 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 AdministratorsHelper
end
| Ruby |
module OrganizationsHelper
end
| Ruby |
module AccountsHelper
end
| Ruby |
module EventsHelper
end
| Ruby |
module OsasHelper
end
| Ruby |
module MembershipsHelper
end
| Ruby |
module AnnouncementsHelper
end
| Ruby |
module AwardsHelper
end
| Ruby |
module MainHelper
end
| Ruby |
class Account < ActiveRecord::Base
#belongs_to :administrator
#belongs_to :organization
#belongs_to :osa
validates_presence_of :password, :username
validates_uniqueness_of :username
validates_length_of :password, :minimum => 5, :too_short => "must be atleast 5 characters long."
end
| Ruby |
class Osa < ActiveRecord::Base
belongs_to :account #, {:foreign_key => 'user_id'}
has_many :announcements, {:foreign_key => 'user_id'}
end
| Ruby |
class Student < ActiveRecord::Base
has_many :memberships
#set_primary_key "student_id"
#
validates_uniqueness_of :student_no
end
| Ruby |
class Event < ActiveRecord::Base
belongs_to :organization
end
| Ruby |
class Notifier < ActionMailer::Base
def sendmail(recipient)
recipients recipient.webmail
cc ["woosh_lee@yahoo.com"]
from "system@bukluran.com"
subject "Membership confirmation"
body :student => recipient
end
end
| Ruby |
class DataFile < ActiveRecord::Base
def self.save(upload, directory_path)
name = upload['datafile'].original_filename
directory = directory_path
path = File.join(directory, name)
File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
end
end
| Ruby |
class Membership < ActiveRecord::Base
belongs_to :student
belongs_to :organization
end
| Ruby |
class Organization < ActiveRecord::Base
belongs_to :account #, {:foreign_key => 'user_id'}
has_many :events
has_many :awards
has_many :memberships
validates_presence_of :name
end
| Ruby |
class Announcement < ActiveRecord::Base
belongs_to :administrator
belongs_to :osa
#belongs_to :account
validates_presence_of :message
end
| Ruby |
class Award < ActiveRecord::Base
belongs_to :organization
end
| Ruby |
class Administrator < ActiveRecord::Base
belongs_to :account #, {:foreign_key => 'user_id'}
has_many :announcements, {:foreign_key => 'user_id'}
end
| Ruby |
class AdministratorsController < ApplicationController
def index
end
end
| Ruby |
class EventsController < ApplicationController
def index
@events = Organization.find_by_account_id(session[:user_id]).events
end
def new
@events = Organization.find_by_account_id(session[:user_id]).events
end
def create
@event = Organization.find_by_account_id(session[:user_id]).events.new(p... | Ruby |
class MainController < ApplicationController
def login
@current_user = Account.find_by_username_and_password( params[:login], params[:password])
@announcements = Announcement.find(:all)
if @current_user
session[:user_id] = @current_user.id
case @current_user.group
when 'ORGANIZATION... | Ruby |
require 'lib/pdfdrawer'
require 'find'
class OsasController < ApplicationController
def index
@user = Osa.find_by_account_id(session[:user_id])
@announcements = Announcement.all
@pending = Organization.all(:conditions => "status = 0")
end
def start_app
@user = Osa.find_by_account_id... | Ruby |
require 'find'
class OrganizationsController < ApplicationController
def index
@data = Organization.find_by_account_id(session[:user_id])
@announcements = Announcement.find(:all)
case @data.status
when -1
flash[:notice] = "Not Renewed"
when 0
flash[:notice] = "Application... | Ruby |
class AnnouncementsController < ApplicationController
def new
@announcements = Osa.find_by_account_id(session[:user_id]).announcements
end
def create
@announcement = Osa.find_by_account_id(session[:user_id]).announcements.new(params[:announcement])
if @announcement.save
redirect_to :controller ... | 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
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for detai... | Ruby |
class AwardsController < ApplicationController
def index
@awards = Organization.find_by_account_id(session[:user_id]).awards
end
def new
@awards = Organization.find_by_account_id(session[:user_id]).awards
@data = @awards.new
end
def create
@award = Organization.find(session[:user_id]).awar... | Ruby |
class AccountsController < ApplicationController
def index
@accounts = Account.find(:all)
end
def show
@account = Account.find(params[:id])
end
def new
@account = Account.new
end
def create
@account = Account.new(params[:account])
if @account.save
flash[:notice] = "Successfu... | Ruby |
class MembershipsController < ApplicationController
def index
end
end
| 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 |
ActionController::Routing::Routes.draw do |map|
#map.resources :accounts
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
map.root :controller => 'main', :action => 'login'
end
| 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 |
# 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 |
# 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 |
# 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 |
require "pdf/simpletable"
class PdfDrawer
def self.draw(org)
pdf = PDF::Writer.new(:paper => "A4")
pdf.text "<c:uline>Osa Form 1</c:uline>", :font_size => 10
pdf.text "<c:uline><b>INFORMATION SHEET FOR STUDENT ORGANIZATIONS</b></c:uline>", :justification => :center, :font_size => 15, :spacing =>... | Ruby |
NOT READY YET
#!/usr/bin/ruby
require 'rubygems'
require 'google/api_client'
require 'oauth/oauth_util'
client = Google::APIClient.new
youtube = client.discovered_api('youtube', 'v3alpha')
auth_util = CommandLineOAuthHelper.new('https://www.googleapis.com/auth/youtube')
client.authorization = auth_util.authorize()
... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'google/api_client'
# oauth/oauth_util is not part of the official Ruby client library.
# Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb
require 'oauth/oauth_util'
require 'trollop'
# This code assumes that there's a client_secrets.j... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'google/api_client'
# oauth/oauth_util is not part of the official Ruby client library.
# Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb
require 'oauth/oauth_util'
# A limited OAuth 2 access scope that allows for read-only access.
YO... | Ruby |
#!/usr/bin/ruby
require 'rubygems'
require 'google/api_client'
# oauth/oauth_util is not part of the official Ruby client library.
# Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb
require 'oauth/oauth_util'
require 'trollop'
# An OAuth 2 access scope that allows for full read... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.