code
stringlengths
1
1.73M
language
stringclasses
1 value
class <%=migration_name%> < ActiveRecord::Migration def self.up create_table :<%=table_name%>, :force => true do |t| t.string :email, :null=> false t.string :username, :null => false t.string :crypted_password, :limit => 40, :null => false t.string :salt, :limit =>4...
Ruby
require_dependency "rails_generator/base" require_dependency "rails_generator/lookup" # here only to make the class instantiable in the console require_dependency "rails_generator" class AuthenticatorPcrGenerator < Rails::Generator::NamedBase self.spec = Rails::Generator::Spec.new File.basename(__FILE__), __FILE__,...
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the authenticator_pcr plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation f...
Ruby
# desc "Explaining what the task does" # task :authenticator_pcr do # # Task goes here # end
Ruby
# Uninstall hook code here
Ruby
# Install hook code here
Ruby
secure_protocol = (RAILS_ENV == 'production' || RAILS_ENV == 'stage') ? https : 'http' resource session_file_name.singularize.to_sym, :controller => session_file_path, :only => [:new, :create, :destroy], :requirements => { :protocol => secure_protocol } resources controller_file_name.to_sym, :contro...
Ruby
module AuthenticatorPcr end
Ruby
module AuthenticatorPcr module Routing # Loads the set of routes from within a plugin and # evaluates them at this point within an application's # main routes.rb file. def from_plugin(name, controller_name, session_name, options={}) plugin_root = File.join(RAILS_ROOT, 'vendor', ...
Ruby
require 'rubygems' require 'active_support' require 'active_support/test_case'
Ruby
# $Id: defaults.spec,v 1.8 2000/04/20 00:10:18 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; ...
Ruby
# $Id: celldata.spec,v 1.11 1999/07/28 14:55:31 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation;...
Ruby
# $Id: clkbuf.spec,v 1.3 1999/01/21 06:35:11 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; ei...
Ruby
# $Id: nand3.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: or3.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eithe...
Ruby
# $Id: inv.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eithe...
Ruby
# $Id: oai21.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: aoi21.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: aoi22.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: stdcells.spec,v 1.4 1999/01/29 07:32:13 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; ...
Ruby
# $Id: and3.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: nand2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: xor2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: dffce.spec,v 1.3 2000/01/08 00:43:35 ryu Exp ryu $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation;...
Ruby
# $Id: mux2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: buf.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eithe...
Ruby
# $Id: ph2latch.spec,v 1.3 1999/01/21 06:35:11 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; ...
Ruby
# $Id: oai22.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: ph1latch.spec,v 1.3 1999/01/21 06:35:11 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; ...
Ruby
# $Id: and2.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: nor3.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: dff.spec,v 1.5 1999/07/28 14:47:51 ryu Exp ryu $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; e...
Ruby
# $Id: nor2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
# $Id: or2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eithe...
Ruby
# $Id: xnor2.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: nand4.spec,v 1.4 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eit...
Ruby
# $Id: common.spec,v 1.3 1999/01/21 06:35:11 ryu Exp ryu $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation...
Ruby
# $Id: and4.spec,v 1.5 1999/06/08 14:43:36 ryu Exp $ # Copyright (C) 1999 Robert K. Yu # email: robert@yu.org # This file is part of Autochar. # Autochar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; eith...
Ruby
=begin rdoc Crappy auto-emo poetry generator =end require 'rubygems' require "hpricot" require "open-uri" require "pp" # Returns an array of lines of poetry def snarf_poetry(url) lines = [] # Load the source page source = Hpricot(open(url)) poem = source.search("//div[@id='rich_content']").inner_html ...
Ruby
#!/usr/bin/ruby # # Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your opti...
Ruby
#!/usr/bin/ruby # # Copyright (C) 2009 Institut fuer Telematik, Universitaet Karlsruhe (TH) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your opti...
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. ## # Default to development if environment is not set. saved = environ...
Ruby
source 'https://rubygems.org' group :development do # Sass, Compass and extensions. gem 'sass' # Sass. gem 'sass-globbing' # Import Sass files based on globbing pattern. gem 'compass' # Framework built on Sass. gem 'compass-validator' # So you can `compass ...
Ruby
notification :off group :development do # Only run Compass if we have a config.rb file in place. if File.exists?("config.rb") # Compile on start. puts `compass compile --time --quiet` # https://github.com/guard/guard-compass guard :compass do watch(%r{.+\.s[ac]ss$}) end end ## Unco...
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. ## # Default to development if environment is not set. saved = environ...
Ruby
source 'https://rubygems.org' group :development do # Sass, Compass and extensions. gem 'sass' # Sass. gem 'sass-globbing' # Import Sass files based on globbing pattern. gem 'compass' # Framework built on Sass. gem 'compass-validator' # So you can `compass ...
Ruby
notification :off group :development do # Only run Compass if we have a config.rb file in place. if File.exists?("config.rb") # Compile on start. puts `compass compile --time --quiet` # https://github.com/guard/guard-compass guard :compass do watch(%r{.+\.s[ac]ss$}) end end ## Unco...
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. ## # Default to development if environment is not set. saved = environ...
Ruby
source 'https://rubygems.org' group :development do # Sass, Compass and extensions. gem 'sass' # Sass. gem 'sass-globbing' # Import Sass files based on globbing pattern. gem 'compass' # Framework built on Sass. gem 'compass-validator' # So you can `compass ...
Ruby
notification :off group :development do # Only run Compass if we have a config.rb file in place. if File.exists?("config.rb") # Compile on start. puts `compass compile --time --quiet` # https://github.com/guard/guard-compass guard :compass do watch(%r{.+\.s[ac]ss$}) end end ## Unco...
Ruby
module CartsHelper end
Ruby
module UsersHelper end
Ruby
module ApplicationHelper def default_text(text) onFocusFunction = "if (this.value=='#{text}') {this.value = '';}" onBlurFunction = "if (this.value=='') {this.value = '#{text}';}else {return false}" {:value => text, :onfocus => onFocusFunction, :onblur => onBlurFunction} end end
Ruby
module CarModelsHelper end
Ruby
module SessionsHelper end
Ruby
module RegionsHelper end
Ruby
module CarBrandsHelper end
Ruby
module AdminHelper end
Ruby
module UsedTypesHelper end
Ruby
module PartConfigurationsHelper end
Ruby
module SuppliersHelper def add_filter_link(name, id) if id.nil? filter = Filter.new else filter = Filter.new(Filter.find(id).attributes) end link_to_function name do |page| page.remove "filterForm" if id.nil? page.insert_html :top, "filters", :partial => 'filt...
Ruby
module GearboxTypesHelper end
Ruby
module PartsHelper end
Ruby
module PartsGroupsHelper end
Ruby
module WelcomeHelper end
Ruby
module CarsHelper end
Ruby
module EngineTypesHelper end
Ruby
module OriginalTypesHelper end
Ruby
module CitiesHelper end
Ruby
class Region < ActiveRecord::Base has_many :cities has_many :region_requests end
Ruby
class User < ActiveRecord::Base attr_accessible :email, :gsm, :city_id, :password, :password_confirmation attr_accessor :password before_save :encrypt_password validates_confirmation_of :password validates_presence_of :password, :on => :create validates_presence_of :email validates_uniqueness_of :em...
Ruby
class PartConfiguration < ActiveRecord::Base belongs_to :cart belongs_to :part belongs_to :parts_group belongs_to :used_type belongs_to :original_type def name if part_id.nil? part_name else part.name end end end
Ruby
class EngineType < ActiveRecord::Base end
Ruby
class UsedType < ActiveRecord::Base end
Ruby
class AdminUser < ActiveRecord::Base attr_accessible :email, :password, :password_confirmation attr_accessor :password before_save :encrypt_password validates_confirmation_of :password validates_presence_of :password, :on => :create validates_presence_of :email validates_uniqueness_of :email de...
Ruby
class Cart < ActiveRecord::Base belongs_to :request has_many :part_configurations end
Ruby
class OriginalType < ActiveRecord::Base end
Ruby
class CityRequest < ActiveRecord::Base belongs_to :city belongs_to :request end
Ruby
class Request < ActiveRecord::Base attr_accessor :car_brand, :car_model, :engine_type, :gearbox_type has_one :cart, :dependent => :destroy belongs_to :car_brand belongs_to :car_model belongs_to :engine_type belongs_to :gearbox_type has_many :region_requests, :dependent => :destroy validates_presence_of...
Ruby
class CarModel < ActiveRecord::Base belongs_to :car_brand end
Ruby
class Supplier < ActiveRecord::Base attr_accessible :email, :password, :password_confirmation attr_accessor :password before_save :encrypt_password validates_confirmation_of :password validates_presence_of :password, :on => :create validates_presence_of :email validates_uniqueness_of :email def...
Ruby
class RegionRequest < ActiveRecord::Base belongs_to :region belongs_to :request end
Ruby
class CarBrand < ActiveRecord::Base has_many :car_models end
Ruby
class Car < ActiveRecord::Base belongs_to :user has_one :car_brand has_one :car_model has_one :engine_type has_one :gearbox_type end
Ruby
class Part < ActiveRecord::Base belongs_to :parts_group has_many :part_configurations end
Ruby
class GearboxType < ActiveRecord::Base end
Ruby
# encoding: utf-8 class Filter < ActiveRecord::Base belongs_to :car_brand belongs_to :car_model belongs_to :engine_type belongs_to :gearbox_type belongs_to :parts_group def parts_group_name if parts_group.nil? "Any" else parts_group.name end end def car_brand_name ...
Ruby
class City < ActiveRecord::Base belongs_to :region def extended_city_name self.name + ", " + City.find(id).region.name end end
Ruby
class PartsGroup < ActiveRecord::Base has_many :parts has_many :parts_configurations end
Ruby
class WelcomeController < ApplicationController autocomplete :part, :name, :full => true autocomplete :city, :name, :full => true, :display_value => :extended_city_name def show @request = Request.new if current_user @request.city_id = current_user.city_id @request.email = current_use...
Ruby
class CarsController < ApplicationController # GET /cars # GET /cars.xml def index @cars = Car.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @cars } end end # GET /cars/1 # GET /cars/1.xml def show @car = Car.find(params[:id]) respo...
Ruby
class SessionsController < ApplicationController def new end def create user = User.authenticate(params[:email], params[:password]) if user session[:user_id] = user.id redirect_to home_path, :notice => "Logged in!" else flash.now.alert = "Invalid email or password" render "new...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery helper_method :current_user, :current_admin, :current_supplier, :current_cart private def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end def current_admin @current_ad...
Ruby
class PartConfigurationsController < ApplicationController # GET /part_configurations # GET /part_configurations.xml def index @part_configurations = PartConfiguration.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @part_configurations } end end ...
Ruby
class PartsGroupsController < ApplicationController # GET /parts_groups # GET /parts_groups.xml def index @parts_groups = PartsGroup.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @parts_groups } end end # GET /parts_groups/1 # GET /parts_group...
Ruby
class AdminController < ApplicationController before_filter :authorize_show, :only => [ :approved_requests, :unapproved_requests, :create_new_supplier] before_filter :authorize_show_new_admin, :only => [:new_admin, :create_new_admin] autocomplete :part, :name, :full => true def index @requests = Re...
Ruby
class RequestsController < ApplicationController def show @request = Request.find(params[:id]) respond_to do |format| format.html # show.html.erb end end def new @request = Request.new respond_to do |format| format.html # new.html.erb end end def edit @request = Re...
Ruby
class CarModelsController < ApplicationController # GET /car_models # GET /car_models.xml def index @car_models = CarModel.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @car_models } end end # GET /car_models/1 # GET /car_models/1.xml def sh...
Ruby
class PartsController < ApplicationController # GET /parts # GET /parts.xml def index @parts = Part.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @parts } end end # GET /parts/1 # GET /parts/1.xml def show @part = Part.find(params[:id]) ...
Ruby
class CarBrandsController < ApplicationController # GET /car_brands # GET /car_brands.xml def index @car_brands = CarBrand.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @car_brands } end end # GET /car_brands/1 # GET /car_brands/1.xml def sh...
Ruby