code
stringlengths
1
1.73M
language
stringclasses
1 value
class Passage < ActiveRecord::Base has_one :item end
Ruby
class Topic < ActiveRecord::Base has_many :items has_many :subtopics has_many :partcodes belongs_to :skill end
Ruby
require "#{RAILS_ROOT}/app/classes/cat/rules/rule" require "#{RAILS_ROOT}/app/classes/cat/cat_item" #* starting_rule.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 Softwa...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/rules/rule" #* stopping_rule.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 3 of the License, o...
Ruby
require "#{RAILS_ROOT}/app/models/item" require "#{RAILS_ROOT}/app/classes/irt/irt_item" #* rule.rb #* Copyright (C) 2010 Embian Inc. # # This program 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, eithe...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/rules/rule" require "#{RAILS_ROOT}/app/classes/cat/cat_item" #* item_selection_rule.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 ...
Ruby
# require "#{RAILS_ROOT}/app/models/exam" # require "#{RAILS_ROOT}/app/models/user" # require "#{RAILS_ROOT}/app/models/skill" require "#{RAILS_ROOT}/app/classes/cat/cat_exam" require "#{RAILS_ROOT}/app/classes/irt/irt_model" #* user_profile.rb #* Copyright (C) 2010 Embian Inc. # # This program is free software: yo...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/cat_item" require "#{RAILS_ROOT}/app/classes/irt/irt_examinee" #* cat_examinee.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 Softw...
Ruby
# require "#{RAILS_ROOT}/app/models/item" require "#{RAILS_ROOT}/app/classes/cat/cat_model" require "#{RAILS_ROOT}/app/classes/irt/irt_item" #* cat_item.rb #* Copyright (C) 2010 Embian Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Licen...
Ruby
require "#{RAILS_ROOT}/app/classes/irt/irt_model" #* cat_model.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 3 of the License, or # ...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/rules/starting_rule" require "#{RAILS_ROOT}/app/classes/cat/rules/item_selection_rule" #* item_selector.rb #* Copyright (C) 2010 Embian Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publi...
Ruby
require "#{RAILS_ROOT}/app/classes/irt/irt" require "#{RAILS_ROOT}/app/classes/cat/cat_item" require "#{RAILS_ROOT}/app/classes/cat/cat_examinee" require "#{RAILS_ROOT}/app/classes/cat/cat_exam" require "#{RAILS_ROOT}/app/classes/irt/irt_algorithm" #* ability_estimator.rb #* Copyright (C) 2010 Embian Inc. # # This p...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/rules/stopping_rule" #* cat_stopper.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 3 of the Lic...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/ability_estimator" require "#{RAILS_ROOT}/app/classes/cat/item_selector" require "#{RAILS_ROOT}/app/classes/cat/cat_stopper" #* cat_ruby.rb #* Copyright (C) 2010 Embian Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
Ruby
require "#{RAILS_ROOT}/app/classes/cat/cat_examinee" require "#{RAILS_ROOT}/app/classes/cat/cat_item" require "#{RAILS_ROOT}/app/classes/irt/irt_exam" #* cat_exam.rb #* Copyright (C) 2010 Embian Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
Ruby
#* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* The IRTExaminee is an class to handle examinee's data. #* Author: KyoungMo Yang(E-mail : mo@embian.com) #* Modified: 2010-11-05 #* References: N/A class IRTExaminee attr_accessor :eid, :no, :theta, :scores, :score, :group, :respons...
Ruby
require "#{RAILS_ROOT}/lib/irt_ruby" require "#{RAILS_ROOT}/app/classes/irt/irt_model" require "#{RAILS_ROOT}/app/classes/irt/irt_algorithm" #* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* IRT class includes methods to estimates item parameters and thetas of examinees based on It...
Ruby
#* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* IRTExam is a class to handle data of test form (e.g., test's score, items, examinees, examinees' responses, etc.). #* Author: KyoungMo Yang(E-mail : mo@embian.com) #* Modified: 2010-11-05 #* References: N/A class IRTExam attr_acces...
Ruby
#* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* IRTItem is class to handle item's data. (i.g., difficulty - irt_b, descriment - irt_a, guessing - irt_c) #* Author: KyoungMo Yang(E-mail : mo@embian.com) #* Modified: 2010-11-05 #* References: N/A class IRTItem #item paramters at...
Ruby
#* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* The IRTEmAlgorithm class provides some options to estimate item paramters(i.g., difficulty, discrimet and guessing) and examinee's theta #* Author: KyoungMo Yang(E-mail : mo@embian.com) #* Modified: 2010-11-05 #* References: Irt_ruby...
Ruby
#* IRTRuby (http://code.google.com/p/irtruby/) #* Copyright (C) 2010, KyoungMo Yang #* IRTModel is a class to handle options of irt model #* Author: KyoungMo Yang(E-mail : mo@embian.com) #* Modified: 2010-11-05 #* References: N/A class IRTModel DICHOTOMOUS_1PL = "1PL" DICHOTOMOUS_2PL = "2PL" DICHOTOMOUS_3PL = "3...
Ruby
#* application_contorller.rb #* Copyright (C) 2010 Embian Inc. # # This program 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 3 of the License, or # (at your option) any later version. #...
Ruby
Dir["#{RAILS_ROOT + '/app/classes/cat'}/*.rb"].each {|file| require file } class CatController < ApplicationController #* Functionailities # * Creates a CAT Exam #* Parameters # * HTTP POST # * [uid] : user id # * [section_id] : section id #* Return # * JSON # * [theta] : initial user's abili...
Ruby
module D def run(*args) puts "#{self.name} : D : #{args}" end end module A include D def run(*args) puts "A : #{args}" end end module B include D def run(*args) puts "B : #{args}" end end class C module E def e puts "e" end end include E class IB incl...
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 do debug a probl...
Ruby
# Be sure to restart your server when you modify this file. # 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. ActiveReco...
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 cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
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! # 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 # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
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 # Full error reports are disabled and caching is turned on config.action_controller.consider_all_reque...
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 'base_resource'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the base_resource plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the base_resource pl...
Ruby
# desc "Explaining what the task does" # task :base_resource do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
# Install hook code here
Ruby
require 'active_record' module Base #:nodoc: module Resource #:nodoc: def self.included(mod) mod.extend(ClassMethods) end module ClassMethods def base_resource(options = {}) options.assert_valid_keys(:key, :url_column, :owner) class_eval do extend Base::Resource:...
Ruby
require 'named_url'
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the base_resource plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the base_resource pl...
Ruby
# Uninstall hook code here
Ruby
# Install hook code here
Ruby
require 'active_record' module Named #:nodoc: module URL #:nodoc: def self.included(mod) mod.extend(ClassMethods) end module ClassMethods def named_url(options = {}) options.assert_valid_keys(:key, :url_column) class_eval do extend Base::Resource::SingletonMethod...
Ruby
class CreateProjects < ActiveRecord::Migration def self.up create_table :projects, :options => 'ENGINE=InnoDB DEFAULT CHARSET=UTF8' do |t| t.string :name, :activity, :last_build_status, :last_build_label t.datetime :last_build_time, :next_build_time t.timestamps end end def self.down ...
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' 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/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/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 ProjectsHelper end
Ruby
class Project < ActiveRecord::Base validates_presence_of :name, :on => :create validates_presence_of :name, :on => :update def Project.from_xml xml xml_doc = REXML::Document.new(xml) projects = [] xml_doc.elements.each('Projects/Project') do |projectElement| project = Project.new(); ...
Ruby
class ProjectsController < ApplicationController # GET /projects # GET /projects.xml def index @projects = Project.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @projects } end end # GET /projects/1 # GET /projects/1.xml def show ...
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 details...
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
ActionController::Routing::Routes.draw do |map| map.resources :projects # 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 :c...
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.0...
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
MISSING_LIBRARIES_MESSAGE = <<EOL Please make sure you\'ve installed following gems before running Rake tasks: gem install builder gem install rubyzip EOL require 'fileutils' require 'pathname' require 'rubygems' begin require 'zip/zip' require 'builder' rescue Exception => e puts "#{e.message}\n#{MISS...
Ruby
require 'rake/tasklib' require 'thread' require 'webrick' require 'browser' require 'test_case_result' require 'jsunit_result' require 'selenium_result' include Browser class JavaScriptTestTask < ::Rake::TaskLib def initialize(name=:test) @name = name @tests = [] @browsers = [] @port ...
Ruby
require 'htree/traverse' require 'htree/parse' class TestCaseResult def self.parse_jsunit(url) test_case_strings = url.split("/").last.split("|") TestCaseResult.new(test_case_strings[0], test_case_strings[2] == 'S', test_case_strings[3], test_case_strings[1]) end def self.parse_selenium(table...
Ruby
require 'win32ole' def kill_process(name) process_table.each{|process| if process.name =~ Regexp.compile(name) puts "terminating #{process.caption} : #{process.commandLine} process" process.Terminate puts "#{process.name} process terminated" end } end def process_exists?(nam...
Ruby
require 'rbconfig' if Config::CONFIG['host'].include?('mswin') require 'win32_process' end if Config::CONFIG['host'].include?('linux') require 'linux_process' end module Browser def host Config::CONFIG['host'] end def macos? host.include?('darwin') end def windows? h...
Ruby