code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Be sure to restart your server when you modify this file.
Charoite::Application.config.session_store :cookie_store, key: '_charoite_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 with "rails... | 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 |
Charoite::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.actio... | Ruby |
Charoite::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 web s... | Ruby |
Charoite::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 test s... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Charoite::Application.initialize!
| 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__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile... | Ruby |
Charoite::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'prod... | Ruby |
module ApplicationHelper
end
| Ruby |
module Editor::Api::TestsHelper
end
| Ruby |
module Editor::PagesHelper
end
| Ruby |
class Test < ActiveRecord::Base
include ActiveModel::MassAssignmentSecurity
attr_accessible :caption, :type, :parent
attr_accessor :type, :parent
def self.where_by_params(params)
attrs = self.accessible_attributes
result = {}
params.each do |key, value|
if(attrs.include? key)
... | Ruby |
module Editor
class PagesController < ApplicationController
def index
end
end
end
| Ruby |
#encoding: utf-8
class Editor::Api::TestsController < Editor::Api::BaseController
def initialize
end
def items(params = {})
p Test.where_by_params(params)
items = []
Test.find_each(:batch_size => 1000) do |test|
items << {
id: test.id,
caption: test.caption
}
end... | Ruby |
#encoding: utf-8
class Editor::Api::BaseController < ApplicationController
def initialize
end
def items
return []
end
def index
render json: {
items: self.items(request.query_parameters())
}
end
def create
data = ActiveSupport::JSON.decode(request.body)
render json: it... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
#!/usr/bin/env rake
# 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__)
Charoite::Application.load_tasks
| Ruby |
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# g... | 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).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Charoite::Application
| Ruby |
driver = Selenium::WebDriver.for :chrome
| Ruby |
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :htmlunit
| Ruby |
driver = Selenium::WebDriver.for :firefox
| Ruby |
require 'rubygems'
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
driver.get "http://google.com"
element = driver.find_element :name => "q"
element.send_keys "Cheese!"
element.submit
puts "Page title is \#{driver.title}"
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { drive... | Ruby |
driver = Selenium::WebDriver.for :ie
| Ruby |
require 'rubygems'
require 'selenium-webdriver'
begin
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox
driver.get "http://www.google.com"
driver.save_screenshot "/Screenshots/google.png"
ensure
driver.quit
end
| Ruby |
require 'rubygems'
require 'selenium-webdriver'
PROXY = "localhost:8080"
proxy = Selenium::WebDriver::Proxy.new(
:http => PROXY,
:ftp => PROXY,
:ssl => PROXY
)
caps = Selenium::WebDriver::Remote::Capabilities.ie(:proxy => proxy)
# you have to use remote, otherwise you'll have to code it yoursel... | Ruby |
require 'rubygems' # not required for ruby 1.9 or if you installed without gem
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
driver.get "http://somedomain/url_that_delays_loading"
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
begin
element = wait.until { driver.find_element... | Ruby |
require 'rubygems'
require 'selenium-webdriver'
PROXY = 'localhost:8087'
profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new(
:http => PROXY,
:ftp => PROXY,
:ssl => PROXY
)
driver = Selenium::WebDriver.for :firefox, :profile => profile
| Ruby |
require 'rubygems' # not required for ruby 1.9 or if you installed without gem
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
driver.manage.timeouts.implicit_wait = 10 # seconds
driver.get "http://somedomain/url_that_delays_loading"
element = driver.find_element(:id => "some-dynamic-element")
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
| Ruby |
module DbJsHelper
end
| Ruby |
module DbjsDataUrlHelper
end
| Ruby |
module DbDataUrlHelper
end
| Ruby |
module DbexampleHelper
end
| Ruby |
module IndexHelper
end
| Ruby |
class Factorymaster < ActiveRecord::Base
set_primary_key "FactoryId"
has_many :factoryoutputs
end
| Ruby |
class Factoryoutput < ActiveRecord::Base
belongs_to :factorymaster
end
| Ruby |
class IndexController < ApplicationController
def index
end
end
| Ruby |
class FormBasedController < ApplicationController
def index
end
def chart
#We first request the data from the form (Default.asp)
intSoups=''
intSalads=''
intSandwiches=''
intBeverages=''
intDesserts=''
intSoups = params["Soups"]
intSalads = params["Salads"]
intSandwiches = pa... | Ruby |
class DbjsDataUrlController < ApplicationController
def default
#Initialize the Pie chart with sum of production for each of the factories
oRs=''
oRs2=''
strQuery=''
#strXML will be used to store the entire XML document generated
strXML =''
#Generate the chart element
strXML = ... | Ruby |
# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
def renderChart(chartSWF, strURL, strXML, chartId, chartWidth, chartHeight, debugMode, registerWit... | Ruby |
class AsdController < ApplicationController
end
| Ruby |
class BasicExampleController < ApplicationController
#This page demonstrates the ease of generating charts using FusionCharts.
#For this chart, we've used a pre-defined Data.xml (contained in /Data/ folder)
#Ideally, you would NOT use a physical data file. Instead you'll have
#your own ASP scripts virtually... | Ruby |
class SalesbyemployeeController < ApplicationController
end
| Ruby |
class DbDataUrlController < ApplicationController
def default
#In this example, we show how to connect FusionCharts to a database
#using dataURL method. In our other examples, we've used dataXML method
#where the XML is generated in the same page as chart. Here, the XML data
#for the chart would b... | Ruby |
class DbexampleController < ApplicationController
def basicdbexample
#In this example, we show how to connect FusionCharts to a database.
#For the sake of ease, we've used an MySQL . It just contains two tables, which are linked to each
#other.
animateChart=''
animateChart = params["animate"]... | Ruby |
class FcController < ApplicationController
layout "fusion"
def encodeDataURL(str strDataURL, str addNoCacheStr)
if addNoCacheStr == true
strDataURL = Time.now.to_f.to_s.gsub('.','_')
else
strDataURL = Time.now.to_f.to_s.gsub('.','_')
end
end
def renderChart(chartSWF, strURL, strXML, chart... | Ruby |
class ArrayExampleController < ApplicationController
#In this example, we plot a Combination chart from data contained
#in an array. The array will have three columns - first one for Quarter Name
#second one for sales figure and third one for quantity.
def combination
#Store Quarter Name, revenue d... | Ruby |
class DbexampleController < ApplicationController
def basicdbexample
#In this example, we show how to connect FusionCharts to a database.
#For the sake of ease, we've used an MySQL . It just contains two tables, which are linked to each
#other.
animateChart = params['animate']
#Set default va... | Ruby |
class TopController < ApplicationController
def topcity(intYear, country,strXML,labelFormatting)
#ntYear = Request.QueryString("year")
#count = Request.QueryString("count")
if count>10 then
labelFormatting = " labelDisplay='ROTATE' slantLabels='1' "
else
labelFormatting = " labelDisplay='STAGGER' "
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 |
class CreateFactorymasters < ActiveRecord::Migration
def self.up
create_table :factorymasters , :primary_key => :FactoryId do |t|
t.column :FactoryName, :string, :null => false
end
end
def self.down
drop_table :factorymasters
end
end | Ruby |
class CreateFactoryoutputs < ActiveRecord::Migration
def self.up
create_table :factoryoutputs do |t|
t.column :FactoryId, :integer, :null => false
t.column :DatePro, :date, :null => false
t.column :Quantity, :float,:null =>false
end
end
execute "alter table factoryoutputs
add... | 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/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/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/plugin' | 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/generate' | 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/server' | 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/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/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/about' | 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/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/performance/profiler'
| Ruby |
#!/usr/bin/env 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 imp... | 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 |
#!/usr/bin/env 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 imp... | 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 |
# 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 |
# 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 |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /mswin32/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
RAILS... | Ruby |
# Be sure to restart your web 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 = ... | Ruby |
# Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | Ruby |
#!/usr/bin/env ruby
class ExampleRemoteLibrary
def count_items_in_directory(path)
Dir.entries(path).find_all{|i| not i.match('^\.')}.length
end
def strings_should_be_equal(str1, str2)
puts "Comparing '#{str1}' to '#{str2}'"
if str1 != str2
raise RuntimeError, "Given strings are not equal"
... | Ruby |
class RubyLibraryExample
def get_server_language
'ruby'
end
# Basic communication
def passing
end
def failing(message)
raise message
end
def logging(message, level='INFO')
puts "*#{level}* #{message}"
end
def returning
'returned string'
end
# Logging
def one_message_w... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.