code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
module Xbrlware module Taxonomies module IFRS20090401 # :nodoc: def AccountingProfit return {"xbrli:balance" => "credit","name" => "AccountingProfit","nillable" => "true","xbrli:periodType" => "duration","id" => "ifrs_AccountingProfit","substitutionGroup" => "xbrli:item","info:creationID" => "i200806241028411001"...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
# namespace aware module NSAware # namespace and namespace prefix attr_accessor :ns, :nsp end
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
# This patch is to fix a bug in Ruby 1.8.x CGI::unescapeHTML # Till we upgrade to Ruby 1.9, we will use this patch. Ruby 1.9 handles it properly. # Other alternative is using htmlentities - http://htmlentities.rubyforge.org/ # # Bug explanation, # CGI::unescapeHTML("Equity in Earnings of") returns "Equity in Earni...
Ruby
#!/usr/bin/ruby # # Author:: xbrlware@bitstat.com # # Copyright:: 2009, 2010 bitstat (http://www.bitstat.com). All Rights Reserved. # # License:: 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...
Ruby
# # This file is only needed for Compass/Sass integration. If you are not using # Compass, you may safely ignore or delete this file. # # If you'd like to learn more about Sass and Compass, see the sass/_README.txt # file for more information. # # This config file is borrowed from Zen, so thanks JohnAlbin for your hard...
Ruby
# # This file is only needed for Compass/Sass integration. If you are not using # Compass, you may safely ignore or delete this file. # # If you'd like to learn more about Sass and Compass, see the sass/_README.txt # file for more information. # # This config file is borrowed from Zen, so thanks JohnAlbin for your hard...
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
task :default => [:test] desc 'Run tests.' task :test => [:clean] do system "rspec --color --format documentation spec" end desc 'Remove any temporary products.' task :clean do system 'find spec -name "*.db" | xargs rm' end
Ruby
module Chess class Player def initialize db=nil @db = db end def next_move_from_game(game, suffix) game[suffix.size..-1].split.first end def next_move suffix if suffix.split.size.even? # max for wthite ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. require 'collada/exporter.rb'
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class Material attr_reader :id def initialize(id, color) ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class IdManager def initialize(initial_entries = []) @id_hash = {} ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. require 'rubystdlib.rb' require 'rexml/Document' module Collada class Mesh attr_accessor :id ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada def Collada.ccw(a, b, c) a[0] * (b[1] - c[1]) - b[0] * (a[1] - c[1]) + c[0] *...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class Contours attr_accessor :vertex_indices, :normal_indices, :count ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class AnimationPath def AnimationPath.set_path(object) object.se...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada def Collada.p_to_s(p) p = p.collect { |n| if n.abs < 1e-10 then 0.0 else n end } ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class Lines attr_accessor :vertex_indices, :count def init...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class LineStrips attr_accessor :vertex_indices def initial...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details.i module Collada class Triangles attr_accessor :vertex_indices, :normal_indices, :count ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class Component attr_accessor :node def initialize(node) ...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. require 'rexml/formatters/default' module REXML module Formatters # Pretty-prints an XML document. T...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. require 'sketchup.rb' require 'rubystdlib.rb' require 'rexml/Document' load 'collada/id_manager.rb' load 'co...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. module Collada class Node attr_accessor :name, :id, :geometries, :components, :nodes, :anima...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. if not file_loaded?("rubystdlib.rb") processor, platform, *rest = RUBY_PLATFORM.split("-") cas...
Ruby
# Author: Michael Burns (mburns@cs.princeton.edu) # Copyright (c) 2009 Michael Burns # # This program is distributed under the terms of the # GNU General Public License. See the COPYING file # for details. require 'sketchup.rb' module SelectionFilter def SelectionFilter.filter(type) new_selection = Sketch...
Ruby
require 'sinatra/activerecord/rake' require './main'
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.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
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.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
# 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
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
NOT READY YET #!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'oauth/oauth_util' client = Google::APIClient.new youtube = client.discovered_api('youtube', 'v3alpha') auth_util = CommandLineOAuthHelper.new('https://www.googleapis.com/auth/youtube') client.authorization = auth_util.authorize() ...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' require 'trollop' # This code assumes that there's a client_secrets.j...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' # A limited OAuth 2 access scope that allows for read-only access. YO...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' require 'trollop' # An OAuth 2 access scope that allows for full read...
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'trollop' # Set DEVELOPER_KEY to the "API key" value from the "Access" tab of the # Google APIs Console <http://code.google.com/apis/console#access> # Please ensure that you have enabled the YouTube Data API for your project. DEVELOPER_KEY = "REP...
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' # oauth/oauth_util is not part of the official Ruby client library. # Get it at http://samples.google-api-ruby-client.googlecode.com/git/oauth/oauth_util.rb require 'oauth/oauth_util' # An OAuth 2 access scope that allows for full read/write access. YOU...
Ruby
#!/usr/bin/ruby # Copyright 2011 Google Inc. All Rights Reserved. # # 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 ...
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
#!/usr/bin/ruby require 'benchmark' Benchmark.bm do |x| [1, 2, 5, 10, 20].each do |thread_count| x.report("#{thread_count} threads:") do system('./analyticsdump.rb', '--threads', thread_count.to_s) end sleep(60) end end
Ruby
#!/usr/bin/ruby require 'rubygems' require 'google/api_client' require 'logger' require 'oauth/oauth_util' require 'sqlite3' require 'thread' require 'trollop' YOUTUBE_API_READONLY_SCOPE = 'https://www.googleapis.com/auth/youtube.readonly' YOUTUBE_ANALYTICS_API_SCOPE = 'https://www.googleapis.com/auth/yt-analytics.re...
Ruby
require 'google/api_client' require 'google/api_client/client_secrets' require 'json' require 'launchy' require 'thin' RESPONSE_HTML = <<stop <html> <head> <title>OAuth 2 Flow Complete</title> </head> <body> You have successfully completed the OAuth 2 flow. Please close this browser window and return to ...
Ruby
class AddGroupConverter < ActiveRecord::Migration def self.up add_column :groups, :lap, :integer, :default => 1 end def self.down remove_column :groups, :lap end end
Ruby
class CreatePackages < ActiveRecord::Migration def self.up create_table :packages do |t| t.string :name t.timestamps end Package.create :name => "Basic Package" end def self.down drop_table :packages end end
Ruby
class AddCaches < ActiveRecord::Migration def self.up add_column :runners, :distance_cache, :decimal, :default => 0, :precision => 10, :scale => 2 add_column :runners, :sessions_cache, :integer, :default => 0 add_column :groups, :distance_cache, :decimal, :default => 0, :precision => 10, :scale => 2 ...
Ruby
class AddAnotherPermission < ActiveRecord::Migration def self.create_permission(name, role, level) Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save! end def self.destroy_permission(name, role, level) Permission.destroy({'name'=>name, 'role'=>role, 'level'=>level}) end def self.up ...
Ruby
class AddStudentPermissions < ActiveRecord::Migration def self.create_permission(name, role, level) Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save! end def self.destroy_permission(name, role, level) thing = Permission.find_by_name_and_role_and_level(name,role,level) thing.destroy ...
Ruby
class CreateLandmarks < ActiveRecord::Migration def self.up create_table :landmarks do |t| t.timestamps t.belongs_to :package t.decimal :lat t.decimal :lng t.string :name t.text :description end end def self.down drop_table :landmarks end end
Ruby
class CreateEntries < ActiveRecord::Migration def self.up create_table :entries do |t| t.integer :runner_id t.integer :sessions t.decimal :distance, :precision => 10, :scale => 2 t.date :date t.timestamps end end def self.down drop_table :entries end end
Ruby
class AllowStudentsToLogin < ActiveRecord::Migration def self.up change_table :users do |t| t.belongs_to :runner, :null => true end end def self.down change_table :users do |t| t.remove_belongs_to(:runner) end end end
Ruby
class AddGoogleApiKeyToPrograms < ActiveRecord::Migration def self.up change_table :programs do |t| #add default of gmaps api for localhost t.string :gmapapi, :default => 'ABQIAAAA3gTQRv5vBcxyNZCSofFHjxTX2XchcwgyHzp4Xo0DHRAzt2aLjhT5z4WqOMUYA0rGg7gTgjNgsEjV_w' end Program.update_all ["gmapapi = ?", 'ABQI...
Ruby
class CreateGroups < ActiveRecord::Migration def self.up create_table :groups do |t| t.integer :site_id t.string :name t.string :description t.timestamps end end def self.down drop_table :groups end end
Ruby
class AddImageToIncentive < ActiveRecord::Migration def self.up add_column :incentives, :data, :binary # , :limit => 1.megabyte add_column :incentives, :content_type, :string add_column :incentives, :name, :string end def self.down remove_column :incentives, :data, :content_type, :name end end
Ruby
class UserUpdate < ActiveRecord::Migration def self.up change_column(:users, :role, :string, :default => "lead") end def self.down change_column(:users, :role, :string, :default => "runner") end end
Ruby
class InitialRelease < ActiveRecord::Migration def self.create_site(name, desc) Site.new({'name'=>name, 'description'=>desc, 'package_id'=>1, 'program_id'=>1}).save! end def self.up User.new({'login'=>'KHooper','password'=>'KHooper','password_confirmation'=>'KHooper','site_id'=>'1','email'=>'email1@email.c...
Ruby
class CreatePrograms < ActiveRecord::Migration def self.up create_table :programs do |t| t.string :name t.timestamps end end def self.down drop_table :programs end end
Ruby
class AddPackageToSite < ActiveRecord::Migration def self.up add_column :sites, :package_id, :int end def self.down remove_column :sites, :package_id end end
Ruby
class CreateRunners < ActiveRecord::Migration def self.up create_table :runners do |t| t.integer :group_id t.string :first_name t.string :last_name t.string :gender t.date :birthdate t.integer :level t.string :shirt_size t.integer :shoe_size t.d...
Ruby
class AddThumbnailsToLandmarks < ActiveRecord::Migration def self.up add_column :landmarks, :content_type, :string add_column :landmarks, :filename, :string add_column :landmarks, :size, :integer add_column :landmarks, :width, :integer add_column :landmarks, :height, :integer end def self.dow...
Ruby
class AdditionalPermissions < ActiveRecord::Migration def self.create_permission(name, role, level) Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save! end def self.destroy_permission(name, role, level) thing = Permission.find_by_name_and_role_and_level(name,role,level) thing.destroy ...
Ruby
class CreateSites < ActiveRecord::Migration def self.up create_table :sites do |t| t.integer :program_id t.string :name t.string :description t.timestamps end end def self.down drop_table :sites end end
Ruby
class DefaultAuth < ActiveRecord::Migration def self.create_permission(name, role, level) Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save! end def self.up User.new({'login'=>'super','password'=>'super','password_confirmation'=>'super', 'email'=>'super@email.com', 'role'=>'super'}).sav...
Ruby
class CreateIncentiveImages < ActiveRecord::Migration def self.up create_table :incentive_images do |t| t.integer :incentive_id, :parent_id, :size, :width, :height t.string :content_type, :filename, :thumbnail t.timestamps end remove_column :incentives, :data remove_column :inc...
Ruby
class TieUsersToGroups < ActiveRecord::Migration def self.up add_column :groups, :user_id, :integer add_column :users, :site_id, :integer end def self.down remove_column :groups, :user_id remove_column :users, :site_id end end
Ruby
class ChangePermissionsAllow < ActiveRecord::Migration def self.create_permission(name, role, level) Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save! end def self.destroy_permission(name, role, level) thing = Permission.find_by_name_and_role_and_level(name,role,level) thing.destroy ...
Ruby
class CreateIncentives < ActiveRecord::Migration def self.up create_table :incentives do |t| t.integer :package_id t.integer :goal t.text :reward t.timestamps end end def self.down drop_table :incentives end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table "users", :force => true do |t| t.column :login, :string t.column :email, :string t.column :crypted_password, :string, :limit => 40 t.column :salt, :str...
Ruby
class CreateRouteSiteJoinTable < ActiveRecord::Migration def self.up create_table :routesites do |t| #note that order is not unique for table, #but unique for site t.integer :order t.references :site t.references :route end end def self.down drop_table :routesite end end
Ruby