code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... | 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
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_reque... | 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 |
#!/usr/bin/env ruby
#require 'rubygems'
require 'hpricot'
require 'json'
def read_json name
return JSON.parse( File.open( name, 'r' ).read )
end
STATES = read_json 'states.json'
class Quit < Exception
end
def make_hash( root, fields )
result = {}
fields.each { |field| add_hash( result, field, root, field ) }
r... | Ruby |
#!/usr/bin/env ruby
#
# Copyright (c) 2011 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... | Ruby |
source "http://rubygems.org"
gem 'sinatra'
gem 'google-api-client'
gem 'httpadapter'
gem 'sanitize'
| 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 |
# 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 |
# 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|
# 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 |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def random_slogan
number = 1 + rand(6)
image_tag("furniture/slogan_pictures/#{number}.png")
end
end
| Ruby |
module MonogramFamiliesHelper
end
| Ruby |
module BrandAdminHelper
end
| Ruby |
module CornersHelper
end
| Ruby |
module CardAdminHelper
end
| Ruby |
module WelcomeHelper
end
| Ruby |
module ColorsHelper
end
| Ruby |
module DataHelper
end
| Ruby |
module CustomizeHelper
end
| Ruby |
module BinaryHelper
end
| Ruby |
module MonogramAdminHelper
end
| Ruby |
module DesignsHelper
end
| Ruby |
class Element < ActiveRecord::Base
belongs_to :color
def upload=(binary_data)
unless binary_data.blank?
self.binary = binary_data.read
end
end
end
class Corner < Element
belongs_to :corner_family
def upload_b=(binary_data)
unless binary_data.blank?
self.binary_b = binary_data.read
end
end
end... | Ruby |
class Brand < ActiveRecord::Base
has_many :products
has_many :designs
has_and_belongs_to_many :elements
has_and_belongs_to_many :colors
has_and_belongs_to_many :monogram_families
def upload_1=(binary_data)
unless binary_data.blank?
self.on_logo = binary_data.read
end
end
def upload_2=(binary_data)
... | Ruby |
class Family < ActiveRecord::Base
def uploaded_data=(binary_data)
unless binary_data.blank?
self.data = binary_data.read
end
end
end
class MonogramFamily < Family
has_many :monograms
end
class CornerFamily < Family
has_many :corners
end | Ruby |
class Color < ActiveRecord::Base
has_and_belongs_to_many :brands
has_many :elements
end
class MonoScheme < Color
end
class DualScheme < Color
end | Ruby |
class Product < ActiveRecord::Base
belongs_to :brand
has_many :elements
end
class Invitation < Product
end
class Rsvp < Product
end
class OrderOfService < Product
end
class Menu < Product
end
class SaveTheDate < Product
end
class NamePlace < Product
end
class ThankYou < Product
end
| Ruby |
class ColorsController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@color_... | Ruby |
class BrandAdminController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@br... | Ruby |
class DesignsController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@desi... | Ruby |
class CardAdminController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@gra... | Ruby |
class WelcomeController < ApplicationController
def index
@brands = Brand.find(:all)
end
end
| Ruby |
class CustomizeController < ApplicationController
def show
@brand = Brand.find(params[:id])
@scheme = @brand.colors[1]
@monogram = Monogram.find_by_color_id(@scheme.id)
@corner = Corner.find_by_color_id(@scheme.id)
@design = Design.find_by_color_id_and_brand_id(@scheme.id,@brand.id)
end
def select_mon... | Ruby |
class MonogramAdminController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
... | Ruby |
class DataController < ApplicationController
def invitation
if params[:uploaded_data]
@uploaded_data = params[:uploaded_data]
names = params[:uploaded_data].read.split("\n")
@result = process_names(names)
else
@result = Array.new
@names = params[:name].values
@names = @names.map { |name... | Ruby |
class MonogramFamiliesController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list... | 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'
require_dependency 'element'
req... | Ruby |
class CornersController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@corne... | Ruby |
class BinaryController < ApplicationController
def monogram
@image_data = Monogram.find(params[:id])
@image = @image_data.binary
send_data(@image, :type => "image/png", :disposition => 'inline')
end
def brand_logo_on
@image_data = Brand.find(params[:id])
@image = @image_data.on_logo
send_data(@image... | 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 AlterElements < ActiveRecord::Migration
def self.up
add_column :elements, :type, :string
add_column :elements, :brand_id, :integer
add_column :elements, :family_id, :integer
add_column :elements, :color, :integer
add_column :elements, :binary, :binary
end
def self.down
remove_column :elem... | Ruby |
class AddBrandsMonograms < ActiveRecord::Migration
def self.up
create_table "brands_elements", :id => false, :force => true do |t|
t.column "brand_id", :integer
t.column "element_id", :integer
end
end
def self.down
drop_table "brands_elements"
end
end
| Ruby |
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :type, :string
t.column :pricea, :decimal
t.column :priceb, :decimal
t.column :pricec, :decimal
t.column :priced, :decimal
t.column :brand_id, :integer
end
end
def self.down
... | Ruby |
class RemoveExtraneousIdFields < ActiveRecord::Migration
def self.up
remove_column :colors, :brand_id
remove_column :elements, :brand_id
end
def self.down
add_column :colors, :brand_id, :integer
add_column :elements, :brand_id, :integer
end
end
| Ruby |
class CreateColors < ActiveRecord::Migration
def self.up
create_table :colors do |t|
t.column :brand_id, :integer
t.column :first, :integer
t.column :second, :integer
end
end
def self.down
drop_table :colors
end
end
| Ruby |
class AddBrandIdToElements < ActiveRecord::Migration
def self.up
add_column :elements, :brand_id, :integer
end
def self.down
remove_column :elements, :brand_id
end
end
| Ruby |
class AddFamily < ActiveRecord::Migration
def self.up
add_column :graphic_items, :family, :string
end
def self.down
drop_column :graphic_items, :family
end
end
| Ruby |
class AddMonogramFamilyId < ActiveRecord::Migration
def self.up
add_column :elements, :monogram_family_id, :integer
end
def self.down
drop_column :elements, :monogram_family_id
end
end
| Ruby |
class AddTypeToColors < ActiveRecord::Migration
def self.up
add_column :colors, :type, :string
end
def self.down
remove_column :colors, :type
end
end
| Ruby |
class CreateElements < ActiveRecord::Migration
def self.up
create_table :elements do |t|
end
end
def self.down
drop_table :elements
end
end
| Ruby |
class AddColorIdToElements < ActiveRecord::Migration
def self.up
add_column :elements, :color_id, :integer
end
def self.down
remove_column :elements, :color_id
end
end
| Ruby |
class AddCornerFamilyId < ActiveRecord::Migration
def self.up
add_column :elements, :corner_family_id, :integer
end
def self.down
remove_column :elements, :corner_family_id
end
end
| Ruby |
class AlterFamilies < ActiveRecord::Migration
def self.up
add_column :families, :type, :string
end
def self.down
drop_column :families, :type
end
end
| Ruby |
class RemoveColorFromElements < ActiveRecord::Migration
def self.up
remove_column :elements, :color
end
def self.down
add_column :elements, :color, :integer
end
end
| Ruby |
class DropGraphicItems < ActiveRecord::Migration
def self.up
drop_table :graphic_items
end
def self.down
create_table "graphic_items", :force => true do |t|
t.column "description", :string
t.column "color_id", :integer
t.column "data", :binary
t.column "family", :string
t... | Ruby |
class AddSecondBinaryColumnToElements < ActiveRecord::Migration
def self.up
add_column :elements, :binary_b, :binary
end
def self.down
remove_column :elements, :binary_b
end
end
| Ruby |
class AlterColors < ActiveRecord::Migration
def self.up
change_column :colors, :first, :string
change_column :colors,:second, :string
end
def self.down
change_column :colors, :first, :integer
change_column :colors, :second, :integer
end
end
| Ruby |
class AddFamilyLink < ActiveRecord::Migration
def self.up
add_column :graphic_items, :family_id, :integer
end
def self.down
remove_column :graphic_items, :family_id
end
end
| Ruby |
class DropMonograms < ActiveRecord::Migration
def self.up
drop_table :monograms
end
def self.down
create_table "monograms", :force => true do |t|
t.column "name", :string
t.column "data", :binary
end
end
end
| Ruby |
class AddBrandsColors < ActiveRecord::Migration
def self.up
create_table "brands_colors", :id => false, :force => true do |t|
t.column "brand_id", :integer
t.column "color_id", :integer
end
end
def self.down
drop_table "brands_colors"
end
end
| Ruby |
class CreateBrands < ActiveRecord::Migration
def self.up
create_table :brands do |t|
t.column :name, :string
t.column :on_logo, :binary
t.column :off_logo, :binary
t.column :description, :text
end
end
def self.down
drop_table :brands
end
end
| Ruby |
class CreateFamilies < ActiveRecord::Migration
def self.up
create_table :families do |t|
t.column :name, :string
t.column :data, :binary
end
end
def self.down
drop_table :families
end
end
| Ruby |
class DropColors < ActiveRecord::Migration
def self.up
drop_table :colors
end
def self.down
create_table "colors", :force => true do |t|
t.column "hex", :string
end
end
end
| Ruby |
class AddBrandsMonogramFamilies < ActiveRecord::Migration
def self.up
end
def self.down
end
end
| Ruby |
#!H:/InstantRails/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 seve... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.