code
stringlengths
1
1.73M
language
stringclasses
1 value
class Camt < ActiveRecord::Base end
Ruby
class StudentEvaluationSecond < ActiveRecord::Base validates_presence_of :evaluator_name, :evaluator_position, :evaluator_department, :quantity_of_work, :quality_of_work, :academic_ability, :ability_to_learn, :practical_ability, :judgment, :management, :communication, :foreign_language, :suitability, :responsibi...
Ruby
# coding: utf-8 class Student_status < ActiveRecord::Base STUDENT_STATUS = [ ["Available", "Available"], ["Accepted", "Accepted"] ] TITLE = [ ["Mr.", "Mr."], ["Ms.", "Ms."], ["Mrs.", "Mrs."]] TITLE_TH = [ ["นาย", "นาย"], ["นางสาว", "นางสาว"], ["นาง", "นาง"]] SEX = [ ...
Ruby
class Company < ActiveRecord::Base end
Ruby
class Country < ActiveRecord::Base COUNTRY = [[ "Thailand", "Thailand"], ["Afghanistan", "Afghanistan"], ["Albania", "Albania"], ["Algeria", "Algeria"], ["Andorra","Andorra"], ["Angola", "Angola"], ["Antigua & Deps", "Antigua & Deps"], ["Argentina", "Argentina"], ["Arm...
Ruby
class CamtsController < ApplicationController # GET /camt # GET /camt.xml def index @camts = Camt.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @camts } end end # GET /camt/1 # GET /camt/1.xml def show @camt = Camt.find(params[:id]) ...
Ruby
class StoreController < ApplicationController def index @products = Product.find_product_for_sale end end
Ruby
class ProductsController < ApplicationController # GET /products # GET /products.xml def index @products = Product.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @products } end end # GET /products/1 # GET /products/1.xml def show @produc...
Ruby
class ApplicationController < ActionController::Base before_filter :authorize, :except => :login helper :all protect_from_forgery protected def authorize unless User.find_by_id(session[:user_id]) session[:original_uri] = request.request_uri flash[:notice] = "Please log in" redirect_to...
Ruby
class StudentEvaluationSecondsController < ApplicationController # GET /student_evaluation_seconds # GET /student_evaluation_seconds.xml def index @student_evaluation_seconds = StudentEvaluationSecond.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @studen...
Ruby
class CompaniesController < ApplicationController # GET /companies # GET /companies.xml def index @companies = Company.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @companies } end end # GET /companies/1 # GET /companies/1.xml def show ...
Ruby
class StudentEvaluationFirstsController < ApplicationController # GET /student_evaluation_firsts # GET /student_evaluation_firsts.xml def index @student_evaluation_firsts = StudentEvaluationFirst.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @student_eva...
Ruby
class StudentsController < ApplicationController # GET /students # GET /students.xml def index @students = Student.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @students } end end # GET /students/1 # GET /students/1.xml def show @studen...
Ruby
class EvaluationResultCamtsController < ApplicationController # GET /evaluation_result_camts # GET /evaluation_result_camts.xml def index @evaluation_result_camts = EvaluationResultCamt.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @evaluation_result_cam...
Ruby
class JobRequirementsController < ApplicationController # GET /job_requirements # GET /job_requirements.xml def index @job_requirements = JobRequirement.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @job_requirements } end end # GET /job_require...
Ruby
class UsersController < ApplicationController # GET /users # GET /users.xml def index @users = User.order(:name) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end # GET /users/1 # GET /users/1.xml def show @user = User.find(para...
Ruby
class CompanyThsController < ApplicationController # GET /company_ths # GET /company_ths.xml def index @company_ths = CompanyTh.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @company_ths } end end # GET /company_ths/1 # GET /company_ths/1.xml ...
Ruby
class StudentThsController < ApplicationController # GET /student_ths # GET /student_ths.xml def index @student_ths = StudentTh.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @student_ths } end end # GET /student_ths/1 # GET /student_ths/1.xml ...
Ruby
class AdminController < ApplicationController # just display the form and wait for user to # enter a name and password def login if request.post? user = User.authenticate(params[:name], params[:password]) if user session[:user_id] = user.id uri = session[:original_uri] se...
Ruby
class CompEvaluationsController < ApplicationController # GET /comp_evaluations # GET /comp_evaluations.xml def index @comp_evaluation = CompEvaluation.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @comp_evaluation } end end # GET /comp_evaluati...
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. # 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
# 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. # 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. CLBSArtDej::Application.config.session_store :cookie_store, :key => '_CLBS-Art-Dej_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 wi...
Ruby
CLBSArtDej::Application.routes.draw do get "admin/login" get "admin/logout" get "admin/index" resources :comp_evaluations resources :users resources :evaluation_result_camts resources :student_evaluation_seconds resources :company_evaluations resources :camts resources :company_ths resou...
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 you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module CLBSArtDej class Application < Rails::Application ...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application CLBSArtDej::Application.initialize!
Ruby
CLBSArtDej::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned...
Ruby
CLBSArtDej::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 we...
Ruby
CLBSArtDej::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 te...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run CLBSArtDej::Application
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.expand_path('../config/application', __FILE__) require 'rake' CLBSArtDej::Application.load_tasks
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
class Hashtest def Sum(a,b) return a+b; end 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
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
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
require 'sinatra/activerecord/rake' require './main'
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resource...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../lib/extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../lib/extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
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/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/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/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/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/benchmarker'
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/plugin'
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/runner'
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/breakpointer'
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/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/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.column :articletitle, :string t.column :author, :string t.column :department_id, :int t.column :receiveddate, :date t.column :reviewdate, :date t.column :contributedate, :date t.column :journal, ...
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 CreateDepartments < ActiveRecord::Migration def self.up create_table :departments do |t| t.column :name, :string t.column :number, :int end end def self.down drop_table :departments end end
Ruby
require 'active_record/fixtures' class LoadUsersData < ActiveRecord::Migration def self.up execute "INSERT INTO users (id,name,hashed_password,salt) VALUES (1,'wangzhx','0c5425876379c50e315a96cf04485ca17494c1ab',379647200.621013017847776)" execute "INSERT INTO users (id,name,hashed_password,salt) VALUES (2,'...
Ruby
class CreateRevisionRecords < ActiveRecord::Migration def self.up create_table :revision_records do |t| t.column :reviewdate, :Date t.column :returndate, :Date t.column :article_id, :int end end def self.down drop_table :revision_records end end
Ruby
class AddOneColumnToRevisionRecords < ActiveRecord::Migration def self.up add_column :revision_records, :reviewer, :string end def self.down remove_column :revision_records, :reviewer end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :name, :string t.column :hashed_password, :string t.column :salt, :string end end def self.down drop_table :users end end
Ruby
class DpmngController < ApplicationController before_filter :authorize def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :li...
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 => '_articlenot...
Ruby
class LoginController < ApplicationController before_filter :authorize, :except =>:login layout "admin" def add_user if(params[:user] != nil) @user = User.new(params[:user]) if request.post? and @user.save flash[:notice] = "User #{@user.name} created" @user = User.new end...
Ruby
class AdminController < ApplicationController before_filter :authorize def index list render :action => 'list' end verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list find_condition @articles = Article.find_articles_by_...
Ruby
module LoginHelper end
Ruby
module AdminHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module DpmngHelper end
Ruby
require 'digest/sha1' class User < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name attr_accessor :password_confirmation validates_confirmation_of :password def validate errors.add_to_base("Missing password") if hashed_password.blank? end def self.authenticate(nam...
Ruby
class Department < ActiveRecord::Base has_many :articles, :order => :author validates_presence_of :name,:number validates_uniqueness_of :name,:number def self.find_all find(:all,:order=>"number") end end
Ruby
class Article < ActiveRecord::Base belongs_to :department acts_as_list :column=>:id ,:scope => :department_id has_many :revision_records, :order => :reviewdate validates_presence_of :articletitle, :author, :department_id validates_uniqueness_of :articletitle def self.find_articles find(:all, :order=>...
Ruby
class RevisionRecord < ActiveRecord::Base belongs_to :article acts_as_list :column =>:id, :scope => :artice_id 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
#!D:/InstantRails/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 seve...
Ruby
#!D:/InstantRails/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 seve...
Ruby
#!D:/InstantRails/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 seve...
Ruby
#!D:/InstantRails/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/fastcg...
Ruby
#!D:/InstantRails/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 seve...
Ruby
#!D:/InstantRails/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/fastcg...
Ruby