code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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/performance/benchmarker'
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/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/plugin'
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/dbconsole'
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/console'
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/inspector'
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/spawner'
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/server'
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/plugin'
Ruby
class CreatePartners < ActiveRecord::Migration def self.up create_table :partners do |t| t.string :pa_name t.text :pa_desc t.string :pa_url t.string :content_type t.string :filename t.integer :size t.integer :width t.integer :height t.timestamps en...
Ruby
class CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t| t.string :ev_title t.text :ev_desc t.string :ev_author t.timestamps end end def self.down drop_table :events end end
Ruby
class CreateAboutComms < ActiveRecord::Migration def self.up create_table :about_comms do |t| t.string :name t.text :content t.string :email t.string :author t.string :admin t.timestamps end end def self.down drop_table :about_comms end end
Ruby
class CreateClients < ActiveRecord::Migration def self.up create_table :clients do |t| t.string :cl_name t.text :cl_desc t.string :content_type t.string :filename t.integer :size t.integer :width t.integer :height t.timestamps end end def self.down ...
Ruby
class CreateAbouts < ActiveRecord::Migration def self.up create_table :abouts do |t| t.string :name t.text :content t.string :author t.string :admin t.timestamps end end def self.down drop_table :abouts end end
Ruby
class CreateSolutions < ActiveRecord::Migration def self.up create_table :solutions do |t| t.string :so_title t.text :so_content t.string :so_author t.integer :solution_type_id t.timestamps end end def self.down drop_table :solutions end end
Ruby
class CreateServices < ActiveRecord::Migration def self.up create_table :services do |t| t.string :sl_title t.text :sl_content t.string :sl_author t.integer :sl_year t.integer :service_type_id t.integer :client_id t.timestamps end end def self.down drop_tabl...
Ruby
class CreateSolutionTypes < ActiveRecord::Migration def self.up create_table :solution_types do |t| t.string :st_name #st_name与service_type的字段相同,请注意 t.timestamps end end def self.down drop_table :solution_types end end
Ruby
class CreateServiceTypes < ActiveRecord::Migration def self.up create_table :service_types do |t| t.string :st_name t.text :st_desc t.timestamps end end def self.down drop_table :service_types end end
Ruby
class CreateBloggers < ActiveRecord::Migration def self.up create_table "bloggers", :force => true do |t| t.column :login, :string t.column :email, :string t.column :crypted_password, :string, :limit => 40 t.column :salt, ...
Ruby
class CreateServiceComments < ActiveRecord::Migration def self.up create_table :service_comments do |t| t.text :sc_desc t.timestamps end end def self.down drop_table :service_comments end end
Ruby
module AuthenticatedSystem protected # Returns true or false if the blogger is logged in. # Preloads @current_blogger with the blogger model if they're logged in. def logged_in? !!current_blogger end # Accesses the current blogger from the session. # Future calls avoid the database bec...
Ruby
module AuthenticatedTestHelper # Sets the current blogger in the session from the blogger fixtures. def login_as(blogger) @request.session[:blogger_id] = blogger ? bloggers(blogger).id : nil end def authorize_as(user) @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Bas...
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
#!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
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
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
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
require 'sinatra/activerecord/rake' require './main'
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 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
module FusionChartsHelper #Contains an array of colors to be used as default set of colors for FusionCharts #arr_FCColors is the array that would contain the hex code of colors #ALL COLORS HEX CODES TO BE USED WITHOUT # #We also initiate a counter variable to help us cyclically rotate through #the array of ...
Ruby
module XmlHelper # This function helps you escape special characters in XML attribute values # Here, we have escaped only single quotes for xml attribute values # You can escape other characters which might be causing issues as xml attribute values def XmlHelper.escape_xml_attribute_values(string_to_escape,...
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/plugin'
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/runner'
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/server'
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/plugin'
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/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/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/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/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/destroy'
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/generate'
Ruby
class CreateFactoryOutputQuantities < ActiveRecord::Migration def self.up create_table :factory_output_quantities do |t| t.primary_key :id t.integer :factory_master_id t.datetime :date_pro t.integer :quantity end end def self.down drop_table :factory_output_quantities end en...
Ruby
class CreateFactoryMasters < ActiveRecord::Migration def self.up create_table :factory_masters do |t| t.primary_key :id t.string :name end end def self.down drop_table :factory_masters end end
Ruby
class CreateFusionchartsGermanFactoryMasters < ActiveRecord::Migration def self.up create_table :fusioncharts_german_factory_masters do |t| t.timestamps end end def self.down drop_table :fusioncharts_german_factory_masters end end
Ruby
class CreateFusionchartsFactoryMasterGermen < ActiveRecord::Migration def self.up create_table :fusioncharts_factory_master_germen do |t| t.timestamps end end def self.down drop_table :fusioncharts_factory_master_germen end end
Ruby
class CreateFusionchartsFrenchFactoryMasters < ActiveRecord::Migration def self.up create_table :fusioncharts_french_factory_masters do |t| t.timestamps end end def self.down drop_table :fusioncharts_french_factory_masters end end
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
class Fusioncharts::JapaneseFactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc', :foreign_key=>"factory_master_id" end
Ruby
#Model class to store data of factory id and name. #As per Ruby On Rails conventions, we have the corresponding table #factory_masters in the database. class Fusioncharts::FactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc' end
Ruby
class Fusioncharts::FrenchFactoryMaster < ActiveRecord::Base has_many :factory_output_quantities, :order => 'date_pro asc', :foreign_key=>"factory_master_id" end
Ruby
#Model class to store output data of factories. #As per Ruby On Rails conventions, we have the corresponding table #factory_output_quantities in the database. class Fusioncharts::FactoryOutputQuantity < ActiveRecord::Base belongs_to :factory_master end
Ruby
# Methods added to this helper will be available to all templates in the application. # These methods can be used to render the chart using FusionCharts module ApplicationHelper require "fusioncharts_helper" include FusionChartsHelper end
Ruby
#Creates xml with values for date of production and quantity for a particular factory #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "date_of_production" and "quantity_number" #The colors for the columns are obta...
Ruby
#Creates xml with values for Factory Output #along with their names and a link to detailed action for each factory. #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name", "factory_output" and "str_data_ur...
Ruby
#Creates xml with values for monthly sales data #The values required for building the xml are hard-coded in this file xml = Builder::XmlMarkup.new xml.graph(:caption=>'Monthly Unit Sales', :xAxisName=>'Month', :yAxisName=>'Units', :decimalPrecision=>'0', :formatNumberScale=>'0') do xml.set(:name=>'Jan',:value=>'...
Ruby
#Creates xml with values for factory output along with their names. It also creates #a link to javascript function updateChart #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name","factory_output" and "f...
Ruby
# Builds xml for sales of various product categories # of a Restaurant to be shown in form of a pie-chart. # The values required here are got as parameters # Expected parameters: str_soups,str_salads,str_sandwiches,str_beverages,str_desserts xml = Builder::XmlMarkup.new xml.graph(:caption=>'Sales by Product Categ...
Ruby
#Creates xml with values for Factory Output #along with their names. #The values required for building the xml is obtained as parameter factory_data #It expects an array in which each element as #a hash with values for "factory_name" and "factory_output" xml = Builder::XmlMarkup.new xml.graph(:caption=>'Factory ...
Ruby
#Creates xml with values for sales data of products #along with their names. #The values required for building the xml is obtained from the corresponding controller action pie_data #It accesses the factory_data array from the controller. #It expects factory_data to be an array in which each element is #itself an...
Ruby
#Creates xml with values for sales data of products #along with their names. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first element as label and second element as value xml = Builder::XmlMarkup.new xml.graph(:...
Ruby
#Creates xml with values for sales data of products #and the quantity of sales in each quarter of a year #by a combination of differing scales of two y-axes. #The values required for building the xml is obtained as parameter arr_data #It expects an array in which each element is #itself an array with first eleme...
Ruby