code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/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/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/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/destroy'
| 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/console'
| 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/about'
| 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/dbconsole'
| 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/plugin'
| 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/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/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/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/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/generate'
| Ruby |
module FoundmodesHelper
end
| Ruby |
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def toggle_div(div)
update_page do |page|
page[div].toggle
end
end
end
| Ruby |
module ClientcategoriesHelper
end
| Ruby |
module ClientstatusesHelper
end
| Ruby |
module LoginHelper
end
| Ruby |
module CommunitiesHelper
end
| Ruby |
module RolesHelper
end
| Ruby |
module ClientsHelper
end
| Ruby |
module CountiesHelper
end
| Ruby |
class TaggedBuilder < ActionView::Helpers::FormBuilder
#<p>
#<label for="client_first_name">First Name</label>
#<%= form.text_area 'first_name' %>
#<p>
def self.create_tagged_field(method_name)
define_method(method_name) do |label, *args|
@template.content_tag("p",
@template.content_ta... | Ruby |
class Community < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
belongs_to :county
end
| Ruby |
class Clientcategory < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
end
| Ruby |
class Foundmode < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
end
| Ruby |
class Client < ActiveRecord::Base
validates_presence_of :first_name
validates_presence_of :last_name
validates_presence_of :address1
validates_presence_of :city
validates_presence_of :state
validates_presence_of :country
validates_presence_of :zip
validates_presence_of :home_phone
validates_presence_o... | Ruby |
class County < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
end
| Ruby |
require 'digest/sha1'
class User < ActiveRecord::Base
validates_presence_of :first_name
validates_presence_of :last_name
validates_presence_of :role_id
validates_presence_of :name
validates_uniqueness_of :name
attr_accessor :password_confirmation
validates_confirmation_of :password
belongs_to :... | Ruby |
class Role < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
end
| Ruby |
class Clientstatus < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :code
validates_uniqueness_of :code
end
| Ruby |
class ClientstatusesController < ApplicationController
layout "application"
# GET /clientstatuses
# GET /clientstatuses.xml
def index
@clientstatuses = Clientstatus.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clientstatuses }
end
end
... | Ruby |
class ClientcategoriesController < ApplicationController
layout "application"
# GET /clientcategories
# GET /clientcategories.xml
def index
@clientcategories = Clientcategory.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clientcategories }
... | Ruby |
class FoundmodesController < ApplicationController
layout "application"
# GET /foundmodes
# GET /foundmodes.xml
def index
@foundmodes = Foundmode.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @foundmodes }
end
end
# GET /foundmodes/1
... | Ruby |
class RolesController < ApplicationController
layout "application"
# GET /roles
# GET /roles.xml
def index
@roles = Role.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @roles }
end
end
# GET /roles/1
# GET /roles/1.xml
def show
... | Ruby |
class LoginController < ApplicationController
layout "application"
def add_user
@user = User.new(params[:user])
if request.post? and @user.save
flash.now[:notice] = "User #{@user.name} has been created"
@user = User.new
end
end
def login
session[:user] = nil
if request.post?
... | Ruby |
class CountiesController < ApplicationController
layout "application"
# GET /counties
# GET /counties.xml
def index
@counties = County.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @counties }
end
end
# GET /counties/1
# GET /countie... | 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
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details... | Ruby |
class CommunitiesController < ApplicationController
layout "application"
# GET /communities
# GET /communities.xml
def index
@communities = Community.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @communities }
end
end
# GET /communiti... | Ruby |
class ClientsController < ApplicationController
layout "application"
# GET /clients
# GET /clients.xml
def index
@clients = Client.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clients }
end
end
# GET /clients/1
# GET /clients/1.xml... | 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):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# 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.
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespa... | 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 |
ActionController::Routing::Routes.draw do |map|
map.resources :foundmodes
map.resources :communities
map.resources :clientcategories
map.resources :counties
map.resources :clients
map.resources :users
map.resources :roles
map.resources :clientstatuses
# The priority is based upon order of c... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your 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 = '2.1... | 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 |
# 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 |
module MigrationHelpers
def add_foreign_key(from_table, from_column, to_table)
constraint_name = "fk_#{from_table}_#{from_column}"
execute %{alter table #{from_table}
add constraint #{constraint_name}
foreign key (#{from_column})
references #{to_table}(id)
}
end
... | 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 |
# 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.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
# Be sure to restart your server when you modify this file.
CLBSArtDej::Application.config.session_store :cookie_store, :key => '_CLBS_ArtDej_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 wit... | 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 |
CLBSArtDej::Application.configure do
# Settings specified here will take precedence over those in config/application.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... | Ruby |
CLBSArtDej::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 we... | Ruby |
CLBSArtDej::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 te... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CLBSArtDej::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__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module CLBSArtDej
class Application < Rails::Application
... | Ruby |
CLBSArtDej::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 'pr... | Ruby |
module StudentHelper
end
| Ruby |
module ApplicationHelper
end
| Ruby |
module SayHelper
end
| Ruby |
class SayController < ApplicationController
def hello
@time = Time.now
end
def goodbye
@files = Dir.glob('*')
end
end
| Ruby |
class StudentController < ApplicationController
def profile
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
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.expand_path('../config/application', __FILE__)
require 'rake'
CLBSArtDej::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 |
#!/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 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.... | 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 =>... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CLBSArtDej::Application
| Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integrati... | Ruby |
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), "blueprint", "blueprint")
# **Basic
#
# Calling this file by itself will pull files from blueprint/src and
# concatenate them into three files; ie.css, print.css, and screen.css.
#
# ruby compress.rb
#
# However, argument variables can be set to c... | Ruby |
#!/usr/bin/env ruby
require "blueprint/blueprint"
require "blueprint/validator"
# This script will validate the core Blueprint files.
#
# The files are not completely valid. This has to do
# with a small number of CSS hacks needed to ensure
# consistent rendering across browsers.
#
# To add your own CSS files for val... | Ruby |
module Blueprint
# parses a hash of key/value pairs, key being output CSS selectors, value
# being a list of CSS selectors to draw from
class SemanticClassNames
attr_accessor :class_assignments
attr_reader :namespace, :source_file
# ==== Options
# * <tt>options</tt>
# * <tt>:namespace</tt... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.