code
stringlengths
1
1.73M
language
stringclasses
1 value
class AddUserNameToUsers < ActiveRecord::Migration def change add_column :users, :user_name, :string end end
Ruby
class AddUserIdToBids < ActiveRecord::Migration def change add_column :bids, :winner_user_id, :integer end end
Ruby
class AddUserYobToUsers < ActiveRecord::Migration def change add_column :users, :user_yob, :integer end end
Ruby
class CreateUserBids < ActiveRecord::Migration def change create_table :user_bids do |t| t.datetime :time t.integer :user_price t.timestamps end end end
Ruby
class DeviseCreateUsers < ActiveRecord::Migration def change create_table(:users) do |t| ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" ## Recoverable t.string :reset_password_to...
Ruby
class CreateBids < ActiveRecord::Migration def change create_table :bids do |t| t.datetime :bid_start_time t.datetime :bid_end_time t.integer :bid_tax t.integer :bid_unit_cost t.string :transaction_status t.timestamps end end end
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 copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'simplecov' SimpleCov.start # Requires supporting ruby files with custom matchers and macros, etc, ...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run CrazyBid::Application
Ruby
require 'mkmf' $CPPFLAGS = $CPPFLAGS + " -I../../include" $LDFLAGS = $LDFLAGS + " -L../../" $LIBS = $LIBS + " -lhpdf -lpng -lz" create_makefile 'hpdf'
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- demo.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appea...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- encryption.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- font_example.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright noti...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- arc_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear ...
Ruby
# # << Haru Free PDF Library 2.0.6 >> -- ext_gstate_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice ...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- ttfont_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appe...
Ruby
# # << Haru Free PDF Library 2.0.0 >> -- text_demo2.rb # # Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice...
Ruby
# # << Haru Free PDF Library 2.0.2 >> -- line_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear...
Ruby
# # << Haru Free PDF Library 2.0.6 >> -- slideshow_demo.rb # # http://libharu.org/ # # Copyright (c) 1999-2006 Takeshi Kanno # # Permission to use, copy, modify, distribute and sell this software # and its documentation for any purpose is hereby granted without fee, # provided that the above copyright notice a...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) File.open(to_file, 'w+') { |f| f.puts updated_site_xml } end end if $0 == __FILE__ FileUpdat...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) File.open(to_file, 'w+') { |f| f.puts updated_site_xml } end end if $0 == __FILE__ FileUpdat...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_site_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to_fi...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_site_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to_fi...
Ruby
require 'capistrano/ext/multistage' set :application, "benchmark" set :repository, "http://svn.crap4j.org/crap4j/benchmark" # If you aren't deploying to /u/apps/#{application} on the target # servers (which is the default), you can specify the actual location # via the :deploy_to variable: set :deploy_to, "/home/cra...
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 # 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
set :deploy_to, "/home/crap4j/#{application}_staging" # note, this could be updated to play nicely with the new namespaces, # but instead, we used a :before hook in ../deploy.rb task :after_update, :roles => :app do run "cp /home/#{user}/benchmark_server_settings/staging_database.yml #{release_path}/config/databas...
Ruby
set :deploy_to, "/home/crap4j/#{application}_production" # note, this could be updated to play nicely with the new namespaces, # but instead, we used a :before hook in ../deploy.rb task :after_update, :roles => :app do run "cp /home/#{user}/benchmark_server_settings/database.yml #{release_path}/config/database.ym...
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
# 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 =~ /(:?mswin|mingw)/ require 'pathname' root_path = Pathname.new(root_path).cleanpath(true).to_s end ...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :stats # 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 :cont...
Ruby
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def format_f(f) "%.1f" % f end end
Ruby
module TagsHelper end
Ruby
module StatsHelper include TagsHelper end
Ruby
require 'ostruct' class Stat < ActiveRecord::Base acts_as_taggable acts_as_versioned validates_presence_of :project_hash, :project_url, :created_at, :crap, :crap_load, :crap_methods, :total_methods, :ones, :twos, :fours, :eights, :sixteens, :thirtytwos, :sixtyfours, :one28s, :two56s validates_numericalit...
Ruby
require 'ziya' class StatsController < ApplicationController include Ziya def average_crap @all_stats = Stat.all_stats render :nothing => true, :text => @all_stats.crap_avg.to_s return end # GET /stats # GET /stats.xml def index @tags = params[:tags] if @tags.nil? || @tags.length =...
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 => '_benchmark_...
Ruby
class TagsController < ApplicationController 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
#!/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/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/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/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/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/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/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/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' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
class CreateStats < ActiveRecord::Migration def self.up create_table :stats do |t| t.column :project_hash, :string t.column :project_url, :string t.column :shared, :boolean t.column :created_at, :datetime t.column :crap, :decimal, :precision => 8, :scale => 2 t.column :crap_lo...
Ruby
class ActsAsTaggableMigration < ActiveRecord::Migration def self.up create_table :tags do |t| t.column :name, :string end create_table :taggings do |t| t.column :tag_id, :integer t.column :taggable_id, :integer # You should make sure that the column created is...
Ruby
class ActsAsVersioned < ActiveRecord::Migration def self.up Stat.create_versioned_table change_column :stat_versions, :crap, :decimal, :precision => 8, :scale => 2 end def self.down Stat.drop_versioned_table end end
Ruby
class AddHistStats < ActiveRecord::Migration def self.up add_column :stats, :project_homepage, :string add_column :stats, :project_name, :string add_column :stats, :ones, :integer add_column :stats, :twos, :integer add_column :stats, :fours, :integer add_column :stats, :eights, :integer ad...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/usr/bin/ruby1.8 ENV['RAILS_ENV'] = 'production' # # 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 R...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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/dispat...
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
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) File.open(to_file, 'w+') { |f| f.puts updated_site_xml } end end if $0 == __FILE__ FileUpdat...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_feature_xml(crap4j_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) File.open(to_file, 'w+') { |f| f.puts updated_site_xml } end end if $0 == __FILE__ FileUpdat...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_site_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to_fi...
Ruby
#!/usr/bin/env ruby class FileUpdater def rewrite_site_xml(crap4j_version, juf_version, from_file, to_file) original_site_xml = File.read(from_file) updated_site_xml = original_site_xml.gsub("0.1.13",crap4j_version) updated_site_xml = updated_site_xml.gsub("2.0.0.000495",juf_version) File.open(to_fi...
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
# 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 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
# 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. # 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