code
stringlengths
1
1.73M
language
stringclasses
1 value
#!/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 CreatePages < ActiveRecord::Migration def self.up create_table :pages do |t| end end def self.down drop_table :pages end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| end end def self.down drop_table :users end end
Ruby
class CreateIntwords < ActiveRecord::Migration def self.up create_table :intwords do |t| end end def self.down drop_table :intwords end end
Ruby
class CreateWords < ActiveRecord::Migration def self.up create_table :words do |t| end end def self.down drop_table :words end end
Ruby
class CreateKinds < ActiveRecord::Migration def self.up create_table :kinds do |t| end end def self.down drop_table :kinds end end
Ruby
class CreateSources < ActiveRecord::Migration def self.up create_table :sources do |t| end end def self.down drop_table :sources end end
Ruby
#!/usr/bin/ruby1.8 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 severely impaired...
Ruby
#!/usr/bin/ruby1.8 # # 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 RAILS_ROOT/log/fastcgi.crash.log #...
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 # == Synopsis # Generates records for the bayes-swarm database containing statistics about words according to the bayes-swarm definition. # This tool can be used for testing purposes to load the bayes-swarm database with fictional data # which can be statistically analyzed and tested. # # For examp...
Ruby
# Provides common functionalities reused across scripts module Common # Given an array of command-line parameters returns the part of them # which is before or after the +opt+ parameter, which acts as separator def split_params(params,opt, after) reject = after res = params.collect do |p| reject ...
Ruby
class Functions def linear const_val = 3 return function { |x| const_val } end def smooth_sin damping = 0.1 cycle = Math::PI / 10 return function { |x| Math.sin( cycle * x) / ( damping * x ) } end ## DO NOT MODIFY BELOW THIS LINE def method_missing(methId, *args) puts "...
Ruby
# statistics2.rb # # distributions of statistics # by Shin-ichiro HARA # # 2003.09.25 # # Ref: # [1] http://www.matsusaka-u.ac.jp/~okumura/algo/ # [2] http://www5.airnet.ne.jp/tomy/cpro/sslib11.htm module Statistics2 SQ2PI = Math.sqrt(2 * Math::PI) # Newton approxima...
Ruby
#!/usr/bin/env ruby # == Synopsis # Generates records for the bayes-swarm database containing statistics about words according to the bayes-swarm definition. # This tool can be used for testing purposes to load the bayes-swarm database with fictional data # which can be statistically analyzed and tested. # # For examp...
Ruby
#!/usr/bin/ruby require 'stopstem_helpers' iws = Intword.find(:all, :conditions => {:language_id => 2600}) puts "id, name, word count" iws.each do |iw| if (is_stop_word?(iw.name)) puts "#{iw.id}, #{iw.name}, #{Word.count(:all, :conditions=>{:intword_id=>iw.id})}" end end
Ruby
#!/usr/bin/ruby require 'stopstem_helpers' iws = Intword.find(:all, :conditions => {:language_id => 2600}) #roots = {} puts "id, name, is_stop, is_root, root, word count" iws.each do |iw| iwroot = root(iw.name) iwcount = Word.count(:all, :conditions=>{:intword_id=>iw.id}) puts "#{iw.id}, #{iw.name}, #{is_s...
Ruby
#!/usr/bin/ruby require 'stopstem_helpers' iws = Intword.find(:all, :conditions => {:language_id => 2600}) #roots = {} puts "id, name, is_stop, is_root, root, word count" iws.each do |iw| iwroot = root(iw.name) iwcount = Word.count(:all, :conditions=>{:intword_id=>iw.id}) puts "#{iw.id}, #{iw.name}, #{is_s...
Ruby
#!/usr/bin/ruby require 'stopstem_helpers' iws = Intword.find(:all, :conditions => {:language_id => 2600}) puts "id, name, word count" iws.each do |iw| if (is_stop_word?(iw.name)) puts "#{iw.id}, #{iw.name}, #{Word.count(:all, :conditions=>{:intword_id=>iw.id})}" end end
Ruby
require 'rubygems' Dir.chdir('../../prototype1/ruby/') require 'swarm_ar_support.rb' require 'ferret' class StopAndStemAnalyzer < Ferret::Analysis::Analyzer include Ferret::Analysis def token_stream(field, str, lang) stop_langs = {:it => Ferret::Analysis::FULL_ITALIAN_STOP_WORDS, :en => Fe...
Ruby
# = ETL Runner # This file is part of the ETL package. # See the documentation for ETLRunner as a starting point. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. # require 'json' require 'yaml' require 'etl/util/lo...
Ruby
# = Standard ETL blocks # This file is part of the ETL package. # This file contains the standard ETL blocks part of the bayes-swarm ETL package. Such blocks # are general purpose ones, which may be usually reused in any chain, independently of its type. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Co...
Ruby
# = Conditional ETL blocks # This file is part of the ETL package. # This file contains ETL blocks that apply conditional rules on the ETL processing sequence. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. requi...
Ruby
# = ETL Utilities : Logging # This file is part of the ETL package. It contains general purpose utilities related # to logging # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. # A module that can be included in cla...
Ruby
# = ETL Utilities : Database management # This file is part of the ETL package. It contains general purpose utilities related # to database management, Data Access Objects (DAO) and database interfacing in general # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm...
Ruby
# = ETL Utilities : ActiveRecord management # This file is part of the ETL package. It contains general purpose utilities related # to the ActiveRecord framework. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. re...
Ruby
# = Database Load ETL blocks # This file is part of the ETL package. # This file contains ETL blocks that can be used to interoperate with a relational database, # during the *load* phase of ETL processes. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project...
Ruby
# = Multiplexer ETL blocks # This file is part of the ETL package. # This file contains the support structures to work with *multiplexed* etl blocks. A # Multiplexer has the ability to perform its subsequent tasks a number of times, # varying the DTO in use from time to time, depending on a given condition. # # == Aut...
Ruby
# = Data Transfer Objects for bayes-swarm # This file contains DTOs specific to the bayes-swarm project. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. require 'dto/dto' # # An ETL DTO is the main object which i...
Ruby
# = Multiplex ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains multiplexers which scan through pages and sources. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 ...
Ruby
# = Data Transfer Objects for bayes-swarm with ActiveRecord support # This file contains DTOs specific to the bayes-swarm project, which are bound # to ActiveRecord entities # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 L...
Ruby
# = Filtering ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains filters that reduce the word list according to various algorithms # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed und...
Ruby
# = Filtering ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains grouping functions that compact the word list according to various algorithms # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # ...
Ruby
# = Extractor ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains extractors that can download pages from the file or load them from filesystem # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # ...
Ruby
# = Cleaning ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains extractors that clean raw contents from the previous steps. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the ...
Ruby
# = Extract ETL blocks # This file contains ETL blocks used for testing purposes. Its content are # subject to change without notice. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. require 'etl/std' require 'etl/m...
Ruby
# = Storage and Load ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains blocks that may be used to store DTOs into various output destinations # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # ...
Ruby
# = Helper ETL blocks for bayes-swarm # This file contains ETL blocks specific to the bayes-swarm project. # It contains helper and utility blocks # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed under the Apache2 License. require 'etl/std' ...
Ruby
# = Data Transfer Objects # This file is part of the ETL package # # == Description # Data Transfer Objects (DTOs) are used to transfer values and application state # between different ETL steps. They can be serialized and deserialized, to allow # ETL partitioning and suspend/resume # # == Serialization # The +json+ f...
Ruby
# = Data Transfer Objects and Active Record # This file is part of the ETL package and contains support structures to map between # DTOs and ActiveRecord. # # == Object-Relational Mapping and JSON # This file enriches ActiveRecord (by mixin some code into <tt>ActiveRecord::Base</tt> ) # to allow to-and-from conversion ...
Ruby
# = Data Transfer Objects for Multiplexers # This file is part of the ETL package # # == Description # This file contains the definition of Data Transfer Objects suitable # for multiplexed use. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed...
Ruby
require 'rubygems' require 'etl/runner' # $-v = true e = ETLRunner.new("etl_sample.yml") e.run
Ruby
# = UnitTest : ActiveRecord - JSON interaction # This file is part of the unit tests for the ETL package # # == Description # The tests in this file verify interactions between ActiveRecord and JSON # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Li...
Ruby
# = UnitTest : ActiveRecord # This file is part of the unit tests for the ETL package # # == Description # The tests in this file verify the correct definition of the ActiveRecord relationships # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project. # Licensed...
Ruby
# = UnitTest : JSON # This file is part of the unit tests for the ETL package # # == Description # The tests in this file verify the correct functioning of JSON mapping for # special types such as Time and BigDecimal # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-sw...
Ruby
# = UnitTest : Multiplex DTOs # This file is part of the unit tests for the ETL package # # == Description # The tests in this file verify the correct functioning of multiplex dtos, both # lazy and not. # # == Author # Riccardo Govoni [battlehorse@gmail.com] # # == Copyright # Copyright(c) 2007 - bayes-swarm project....
Ruby
require 'net/http' require 'rss/1.0' require 'rss/2.0' require 'open-uri' require 'time' class HttpExtractor def extract(page) response = extract_with_redirect(page.url) response.body end def extract_with_redirect(url, limit=10, try=1) fail "#{self.class.name}: http redirect too deep" if limit.zero? ...
Ruby
require 'rubygems' gem 'ferret' require 'ferret' class FerretStemmer def stem(content, lang) langs = {:it => Ferret::Analysis::FULL_ITALIAN_STOP_WORDS, :en => Ferret::Analysis::EXTENDED_ENGLISH_STOP_WORDS} analyzer = StopAndStemAnalyzer.new stream = analyzer.token_stream(nil, content, ...
Ruby
class HtmlTidy def clean(content) strip_tags_and_entities(tidy(content)) end def tidy(content) File.open("tidy.tmp","w") do |file| file.puts content end clean_content = %x{ tidy tidy.tmp } File.delete("tidy.tmp") return clean_content end def strip_tags...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'swarm_init' require 'swarm_support' require 'swarm_ar_support' notidy = true pages = Page.find(:all) for page in pages begin interesting_stems = Intword.get_intwords_hash(page.language_id) counted_intstems, pop_stems = swarm_extract(page, notidy, interesting_...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'swarm_init' require 'swarm_support' require 'swarm_ar_support' notidy = true pages = Page.find(:all) for page in pages begin interesting_stems = Intword.get_intwords_hash(page.language_id) counted_intstems, pop_stems = swarm_extract(page, notidy, interesting_...
Ruby
#!/usr/bin/env ruby require 'time' # Option parsing require 'optparse' require 'ostruct' # bayes-swarm specific require 'swarm_support' class Page attr_accessor :id, :url, :language_name, :kind_name, :last_scantime def initialize(id, url, language_name, kind_name, last_scantime) @id = id @url = url ...
Ruby
# Copyright 2007 Associazione Bayesfor. # Created by Riccardo Govoni (riccardo.govoni@bayesfor.eu) require 'digest/md5' require 'tmpdir' require 'pathname' # A module which contains storage-related utils module Storage # A mixin for extractors that need file-saving capabilities module FileSaver # Canary...
Ruby
require 'yaml' # Load global options configFile = "swarm_shoal_options.yml" $opts = YAML.load(File.open(configFile)) # Enables file storage if required storage_opts = $opts['storage'] if storage_opts && storage_opts[:filesaver] == 'active' require 'extractor' require 'swarm_storage' # enrich extractors cla...
Ruby
require 'extractor' require 'html_tidy' require 'stemmer' class Stem attr_accessor :stem , :count, :id def initialize(stem, count, id) @id = id @stem = stem @count = count end end def swarm_extract(page, notidy=true, interesting_stems=nil, pop_stems_threshold=5) # Components setup if (page....
Ruby
require 'active_record' require 'swarm_init.rb' db_opts = $opts['database'] @db_host = db_opts[:host] @db_user = db_opts[:user] @db_pass = db_opts[:pass] @db_name = db_opts[:db] ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => @db_host, :username => @db_user, :password => @db_pass, ...
Ruby
require 'rss/1.0' require 'rss/2.0' require 'open-uri' require 'mysql' dbh = Mysql.real_connect("localhost", "testuser", "test", "bayesfortest") sou = dbh.prepare "INSERT INTO sources ( name, language ) values ( ? , ?)" get = dbh.prepare "SELECT id FROM sources WHERE name = ? " pag = dbh.prepare "INSERT INTO pages ( s...
Ruby
#!/usr/bin/env ruby require 'time' # Option parsing require 'optparse' require 'ostruct' # bayes-swarm specific require 'swarm_support' class Page attr_accessor :id, :url, :language_name, :kind_name, :last_scantime def initialize(id, url, language_name, kind_name, last_scantime) @id = id @url = url ...
Ruby
require 'rsruby' require 'rsruby/dataframe' module R_Config R = RSRuby.instance end
Ruby
class Array def sum inject( nil ) { |sum,x| sum ? sum+x : x } end def mean sum=0 self.each {|v| sum += v} sum/self.size.to_f end def variance m = self.mean sum = 0.0 self.each {|v| sum += (v-m)**2 } sum/self.size end def stdev Math.sqrt(self.variance) end def c...
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
# Add date string parser class method to Date class. # class Date # Parse date string with one of the following formats: # # * -n[units]: Date from self: examples: '1d', '2d', '1m', '2y' # # The string argument is first converted to a string with #to_s. # Returns nil if passed nil or an empty string. # Ra...
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 RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) unless defined?(Rails::Initializer) if File.directory?("#{RAILS_ROOT}/vendor/rails") require "#{RAILS_ROOT}/vendor/rails/railties/lib/init...
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
module Admin::HomeHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def font_size_for_tag_cloud_new( weight, lowest_w, highest_w, steps=5, size_max=26) return nil if weight.nil? or lowest_w.nil? or highest_w.nil? # work out the font size size_min =...
Ruby
module WikiHelper end
Ruby
module SourceHelper end
Ruby
module IgHelper end
Ruby
module OfcHelper end
Ruby
module IntwordHelper end
Ruby
module HomeHelper end
Ruby
module FeaturedHelper end
Ruby
module PageHelper end
Ruby
module PagestoreHelper end
Ruby
module LoginHelper end
Ruby
class Page < ActiveRecord::Base belongs_to :source belongs_to :kind belongs_to :language has_many :word, :dependent => :destroy validates_presence_of :url def before_create self.created_at = Time.now() end end
Ruby
class Intword < ActiveRecord::Base belongs_to :language has_many :words attr_accessor :corr validates_presence_of :name, :language_id validates_uniqueness_of :name, :scope => :language_id def self.find_popular(l_id, interval='1m', n=999999, order_column="imp", visible=1, like=nil) first_date = Date.to...
Ruby
class PageStore attr_reader :counts, :words, :pages, :total def initialize @counts = {} @words = {} @total = 0 end def add(intword,page_id,count) @words[intword] ||= intword.id page ||= Page.find(page_id) @counts[page] ||= {} @counts[page][intword.name] ||= 0 @count...
Ruby
require "digest/sha1" class User < ActiveRecord::Base attr_accessor :password attr_accessible :name, :password, :fullname, :email def before_create self.hashed_password = User.hash_password(self.password) end def after_create @password = nil end def self.hash_password(password) Diges...
Ruby
class Kind < ActiveRecord::Base end
Ruby
class Word < ActiveRecord::Base belongs_to :intword belongs_to :page end
Ruby
class Source < ActiveRecord::Base has_many :pages, :dependent => :destroy has_many :words, :through => :pages validates_presence_of :name def before_create self.created_at = Time.now() end end
Ruby
class HomeController < ApplicationController layout "standard" def index @n_intwords = Intword.count(:conditions => "visible=1") @n_languages = LOCALES.length @n_words = Word.count().localize @attr = 'imp' @action = 'show' @intwords = Intword.find_popular(Locale.language.id, '1m', 50, @att...
Ruby
class IntwordController < ApplicationController layout "standard" # FIXME: add delete before_filter :authorize, :only => [:edit, :notvisible_cloud, :csv] def index # cloud @attr = 'imp' @action = 'show' @intwords = Intword.find_popular(Locale.language.id, '1m', 999999, @attr, 1) end ...
Ruby
class SourceController < ApplicationController layout "standard" before_filter :authorize, :only => [:edit, :new, :destroy, :csv] def index list render :action => 'list' end def list sources_with_pages_in_cur_locale = Page.find(:all, :conditions...
Ruby
class AdminController < ApplicationController #layout "admin" layout "standard" before_filter :authorize def index end def translate_new #@view_translations = ViewTranslation.find(:all, :conditions => [ 'built_in = 1 AND language_id = ?', Locale.language.id ], :order => 'text') # untranslated ...
Ruby
class OfcController < ApplicationController DEFAULT_OPTIONS = { :kind => :default, :graph_colors => [ '#fffc23' , '#616BDB' , '#65AB45' , '#BE4F3C' , '#824D7D' ], :bg_color => '#000000', :pie_bg_color => '#222222', :inner_background => ["#000000", "#444444"], :x_axis => '#ffffff', :x_axis...
Ruby
require 'hpricot' require 'open-uri' class WikiController < ApplicationController layout "standard" BASE_URL = "http://www.bayesfor.eu" def view url = ([] << params[:path]).flatten.join("/") doc = Hpricot(open(BASE_URL + "/wiki/" + url)) # Some smart image resizing to comply with the limi...
Ruby
class PageController < ApplicationController layout "standard" before_filter :authorize, :only => [:edit, :new, :destroy, :csv] def index list render :action => 'list' end def list @page_pages, @pages = paginate(:page, :per_page => 20, ...
Ruby
class LoginController < ApplicationController #layout "admin" layout "standard" before_filter :authorize, :except => :login def login if request.get? session[:user_id] = nil @user = User.new else @user = User.new(params[:user]) logged_in_user = @user.try_to_login if logg...
Ruby
require 'pagestore' class PagestoreController < ApplicationController layout "standard" , :only => "disclaimer" def show intword_ids = params[:id].split("-") @date = Date.strptime(params[:date]) @store = PageStore.new #FIXME(battlehorse): warning! this performs N+1 queries intword_...
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 => '_website_se...
Ruby
class IgController < ApplicationController def elections # def interesting words for usprimary2008 @candidate={"all" => "330-331-333-321-332", "rep" => "333-335-340-341-331", "dem" => "321-330-332-348-338", "ita" => "98-115-118-3370" } if ( params[:id] == nil ) ...
Ruby
class FeaturedController < ApplicationController layout "standard" def index end def usprimary2008 # def interesting words for usprimary2008 @candidate={"all" => "330-331-333-321-332", "rep" => "333-335-340-341-331", "dem" => "321-330-332-348-338" } if ( params[:id] ==...
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