code
stringlengths
1
1.73M
language
stringclasses
1 value
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...
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...
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
class CreateArticles < ActiveRecord::Migration def self.up create_table :articles do |t| t.integer :issue_id t.integer :box_id t.string :name t.integer :start_page t.integer :end_page t.integer :number t.timestamps end end def self.down drop_table :articles ...
Ruby
class CreateKeywords < ActiveRecord::Migration def self.up create_table :keywords do |t| t.string :word t.timestamps end end def self.down drop_table :keywords end end
Ruby
class CreateIssues < ActiveRecord::Migration def self.up create_table :issues do |t| t.integer :journal_id t.integer :month t.integer :day t.integer :year t.timestamps end end def self.down drop_table :issues end end
Ruby
class CreateJournals < ActiveRecord::Migration def self.up create_table :journals do |t| t.string :name t.timestamps end end def self.down drop_table :journals end end
Ruby
class CreateBoxes < ActiveRecord::Migration def self.up create_table :boxes do |t| t.integer :number t.timestamps end end def self.down drop_table :boxes end end
Ruby
class CreateAuthors < ActiveRecord::Migration def self.up create_table :authors do |t| t.string :first_name t.string :middle_initial t.string :last_name t.timestamps end end def self.down drop_table :authors 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:/devutils/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...
Ruby
#!C:/devutils/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.cr...
Ruby
#!C:/devutils/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...
Ruby
#!C:/devutils/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...
Ruby
#!C:/devutils/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.cr...
Ruby
#!C:/devutils/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...
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 JournalsHelper end
Ruby
module AuthorsHelper end
Ruby
module BoxesHelper end
Ruby
module IssuesHelper end
Ruby
module KeywordsHelper end
Ruby
module ArticlesHelper end
Ruby
class Issue < ActiveRecord::Base end
Ruby
class Author < ActiveRecord::Base end
Ruby
class Keyword < ActiveRecord::Base end
Ruby
class Journal < ActiveRecord::Base end
Ruby
class Box < ActiveRecord::Base end
Ruby
class Article < ActiveRecord::Base end
Ruby
class AuthorsController < ApplicationController # GET /authors # GET /authors.xml def index @authors = Author.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @authors } end end # GET /authors/1 # GET /authors/1.xml def show @author ...
Ruby
class ArticlesController < ApplicationController # GET /articles # GET /articles.xml def index @articles = Article.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @articles } end end # GET /articles/1 # GET /articles/1.xml def show ...
Ruby
class BoxesController < ApplicationController # GET /boxes # GET /boxes.xml def index @boxes = Box.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @boxes } end end # GET /boxes/1 # GET /boxes/1.xml def show @box = Box.find(params[:i...
Ruby
class IssuesController < ApplicationController # GET /issues # GET /issues.xml def index @issues = Issue.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @issues } end end # GET /issues/1 # GET /issues/1.xml def show @issue = Issue.f...
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
class JournalsController < ApplicationController # GET /journals # GET /journals.xml def index @journals = Journal.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @journals } end end # GET /journals/1 # GET /journals/1.xml def show ...
Ruby
class KeywordsController < ApplicationController # GET /keywords # GET /keywords.xml def index @keywords = Keyword.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @keywords } end end # GET /keywords/1 # GET /keywords/1.xml def show ...
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 :boxes map.resources :keywords map.resources :authors map.resources :articles map.resources :issues map.resources :journals # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: ...
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.1...
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
# 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
require 'RMagick' class NumberImageGenerator @@IMAGE_DIR = 'numbers-hdpi/' def generate(text, fs=18) #filename = "b" + sprintf("%03d", text) + ".png"; filename = "" + sprintf("%03d", text) + ".png"; font_size = fs; height = 35; width = 35; image = Magick::Image.new(width, height) {self.ba...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 project = 'battery-indicator' user = `cat ~/.netrc | awk '{print $4;}'`.strip pass = `cat ~/.netrc | awk '{print $6;}'`.strip version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1] apk_location = "BatteryIndicatorPro-#{version}.apk" system("cp bin/*-release.ap...
Ruby
#!/usr/bin/env ruby require 'net/http' require 'uri' LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/' langs = Net::HTTP.get(URI.parse(LANGS_URI)).split() langs.each do |lang| if lang.length == 2 dir = 'res/values-' << lang else dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2] end if ! D...
Ruby
# -*- Ruby -*- require 'fileutils' def find_version File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/ $version = $1 end find_version FileUtils.mkdir_p('pkg') desc "convert some textmate bundles to yasnippets" task :convert_bundles do Dir.glob "extras/bundles/*-tmbundle" do |bundle_dir| ...
Ruby
# -*- Ruby -*- require 'fileutils' def find_version File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/ $version = $1 end find_version FileUtils.mkdir_p('pkg') desc "convert some textmate bundles to yasnippets" task :convert_bundles do Dir.glob "extras/bundles/*-tmbundle" do |bundle_dir| ...
Ruby
# Is sheet 01 (after the TOC) a left sheet or a right sheet? sheet1: right # "left" and "right" specify which page of a two-page spread a file # must start on. "left" means that a file must start on the first of # the two pages. "right" means it must start on the second of the two # pages. The file may start in eit...
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). ActiveRecord::Base.transaction do # Categories # Control categories control_categories = [ ["Access Contr...
Ruby
class AddPersonLanguage < ActiveRecord::Migration # Add a 'language_id' association from Person to the Option table # Local models so that migration is safe class Option < ActiveRecord::Base attr_accessible :role, :title end def up add_column :people, :language_id, :integer Option.reset_column_...
Ruby
class AddDocumentOptionColumns < ActiveRecord::Migration def up change_table :documents do |t| t.text :description t.references :type t.references :kind t.references :year t.references :language end end def down change_table :documents do |t| t.remove :description ...
Ruby
class AddKindToPrograms < ActiveRecord::Migration def change add_column :programs, :kind, :string end end
Ruby
class RemoveControlIdFromRequests < ActiveRecord::Migration def up # replace all controls with adequate control assessments Request.all.each do |request| if request.control_id.present? control_assessment = ControlAssessment.where(:control_id => request.control_id, :pbc_list_id => request.pbc_lis...
Ruby
class FixRelationshipDescription < ActiveRecord::Migration def up rename_column :relationship_types, :forward_short_description, :forward_phrase rename_column :relationship_types, :backward_short_description, :backward_phrase end def down rename_column :relationship_types, :forward_phrase, :forward_s...
Ruby
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.string :slug t.string :title t.text :description t.string :url t.references :modified_by t.datetime :start_date t.datetime :stop_date t.timestamps end end end
Ruby
class LinkAccountsAndPeople < ActiveRecord::Migration # This migration does a few different things: # Adds an association between accounts and people # Renames the username attribute to email in people # Links accounts to people via e-mail, creating people # as necessary to map to accounts. # Local models ...
Ruby
class AddNotesToSystems < ActiveRecord::Migration def change add_column :systems, :notes, :text end end
Ruby
class CreateControlRisks < ActiveRecord::Migration def change create_table :control_risks do |t| t.references :control, :null => false t.references :risk, :null => false t.references :modified_by t.timestamps end end end
Ruby
class ChangeStatusValues < ActiveRecord::Migration # "Draft" remains "Draft" in the new arrangement. REQUEST_STATUS_MIGRATIONS = [ ["Waiting Compliance", "Requested"], ["Waiting Auditors", "Responded (by Compliance)"], ["Completed", "Accepted (by Auditor)"] ] def up REQUEST_STATUS_M...
Ruby
class AddPopulationSampleFieldsToResponses < ActiveRecord::Migration def change add_column :responses, :population_document_id, :integer add_column :responses, :population, :integer add_column :responses, :sample_worksheet_document_id, :integer add_column :responses, :samples, :integer add_column ...
Ruby
class AddProgramIdToCycles < ActiveRecord::Migration def change add_column :cycles, :program_id, :integer end end
Ruby
class ChangePolymorphicTypesFromProgramToDirective < ActiveRecord::Migration RELATIONSHIP_TYPE_NAME_CHANGES = [ [:program_applies_to_data_asset, :directive_applies_to_data_asset], [:program_applies_to_facility, :directive_applies_to_facility], [:program_applies_to_market, :directive_applies_to_marke...
Ruby
class EnsureRequestTypeIdIsNotNil < ActiveRecord::Migration def up Request.all.reject(&:type_name).each{ |r| r.update_attribute(:type_id, 1) } end def down end end
Ruby