code
stringlengths
1
1.73M
language
stringclasses
1 value
#-- vim:sw=2:et #++ # # :title: BRAX (Bored of Reason API over XML-RPC) # # Author:: Jason Hines <jason@greenhell.com> # Copyright:: (C) 2008 BoR/PLiK Heavy Development # License:: N/A # # Docs: http://bordom.net/brax/ # Code: http://code.google.com/p/brax/ require "xmlrpc/client" require "net/http" define_structure ...
Ruby
class CreateProcessedDumps < ActiveRecord::Migration def self.up create_table :processed_dumps do |t| t.column :name, :string t.column :rows, :int t.column :offers, :int end end def self.down drop_table :processed_dumps end end
Ruby
class CreateRecacheStores < ActiveRecord::Migration def self.up create_table :recache_stores do |t| t.string :request_hash t.text :data t.datetime :cached_until end add_index :recache_stores, :request_hash end def self.down drop_table :recache_stores 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 Railify < ActiveRecord::Migration def self.up rename_table :dgmAttributeTypes, :properties rename_column :properties, :attributeID, :id rename_column :properties, :graphicID, :graphic_id rename_column :properties, :attributeCategory, :category_id rename_column :properties, :maxAttributeID, ...
Ruby
class CreateRoles < ActiveRecord::Migration def self.up create_table "roles" do |t| t.column :name, :string end # generate the join table create_table "roles_users", :id => false do |t| t.column "role_id", :integer t.column "user_id", :integer end add_index "r...
Ruby
class Offers < ActiveRecord::Migration def self.up create_table "offers", :id => true do |t| t.column "region_id", :integer t.column "solarsystem_id", :integer t.column "station_id", :integer t.column "price", :float t.column "item_id", :integer t.column "sell", :bool t.column "...
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
#!D:/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
#!D:/InstantRails/ruby/bin/ruby # # 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/fastcg...
Ruby
#!D:/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
#!D:/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
#!D:/InstantRails/ruby/bin/ruby # # 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/fastcg...
Ruby
#!D:/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
#!/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/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/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
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def number_to_isk(isk) number_with_delimiter(isk, ".") + " ISK" end def number_to_human(n) number_with_delimiter(n, ".") end end
Ruby
module OfferHelper end
Ruby
module ProductionHelper end
Ruby
class Effect < ActiveRecord::Base has_and_belongs_to_many :items #, :join_table => "dgmTypeEffects", :foreign_key => "effectID", :association_foreign_key => "typeID" end
Ruby
class Marketgroup < ActiveRecord::Base has_many :item has_one :category end
Ruby
class Offer < ActiveRecord::Base belongs_to :item belongs_to :region belongs_to :solarsystem def self.median(id) @total = 0 @offers = find(:all, :conditions => "item_id = #{id}") @offers.each { |o| @total = @total + o.price } return @total / @offers.length end def self.search(id) return find(:a...
Ruby
class Notification < ActionMailer::Base def forgot(user, app, sent_on = Time.now) @recipients = "#{user.login} <#{user.email}>" @from = "#{app['title']} Admin <#{app['email']}>" @subject = 'Password Reminder' @body = {'user' => user, 'app' => app} @sent_on = sent_on end def ...
Ruby
class Region < ActiveRecord::Base belongs_to :universe has_many :constellations has_many :solarsystems end
Ruby
class Kill < ActiveRecord::Base # primary_key "kll_id" # establish_connection :killboard def self.kills data = Kill.find(:all, :select => "(29999999 + kll_system_id) as id, COUNT(kll_id) AS kills", :group => "kll_system_id") @kills = Array.new(0) data.each do |kill| @kills[kill.id.to_i]...
Ruby
class Solarsystem < ActiveRecord::Base belongs_to :region belongs_to :constellation has_and_belongs_to_many :gates, :join_table => "solarsystems_jumps", :class_name => "Solarsystem", :association_foreign_key => :jump_id def self.search(query) self.find_by_name(query) end def self.find_by_re...
Ruby
class Item < ActiveRecord::Base has_and_belongs_to_many :effects has_and_belongs_to_many :properties, :conditions => "published = 1" belongs_to :group belongs_to :marketgroup has_one :blueprint has_many :materials, :conditions => "activity = 1 AND quantity > 0" has_many :sell_prices, :class_name => "Offer...
Ruby
class Property < ActiveRecord::Base has_and_belongs_to_many :items belongs_to :category end
Ruby
class Constellation < ActiveRecord::Base belongs_to :region has_many :solarsystem end
Ruby
class Category < ActiveRecord::Base has_many :groups has_one :property end
Ruby
class Universe < ActiveRecord::Base has_many :region end
Ruby
class Blueprint < ActiveRecord::Base belongs_to :blueprint belongs_to :item end
Ruby
class Role < ActiveRecord::Base end
Ruby
class Material < ActiveRecord::Base belongs_to :item, :foreign_key => "requiredType_id" end
Ruby
class External < ActiveRecord::Base self.abstract_class = true establish_connection :killboard end
Ruby
class Group < ActiveRecord::Base has_one :item belongs_to :category end
Ruby
class ProcessedDumps < ActiveRecord::Base end
Ruby
class ProductionController < ApplicationController def search @query = params[:q] || "" @items = Item.search_blueprint(@query) if @items.empty? flash[:notice] = "Sorry nothing found!" redirect_to :action => "index" else @items.each_with_index do |item, i| @items[i].total...
Ruby
class AccountController < ApplicationController # Be sure to include AuthenticationSystem in Application Controller instead include AuthenticatedSystem # If you want "remember me" functionality, add this before_filter to Application Controller before_filter :login_from_cookie # say something nice, you goof! ...
Ruby
class MapController < ApplicationController def index region = 'Genesis' queue = Solarsystem.find_by_region(region) start = Solarsystem.find_by_name('Menai') stop = Solarsystem.find_by_name('Chej') entf = Math::sqrt((start.x - stop.x)**2 + (start.y - stop.y)**2 + (start.z - stop.z)**2) cur = start while(c...
Ruby
class BrowseController < ApplicationController def auto_complete_for_browse_item value = params[:browse][:item] @items = Item.find(:all, :select => "name", :conditions => ['published = 1 AND marketgroup_id IS NOT NULL AND LOWER(name) LIKE ?', "%#{value.downcase}%"], :order => 'name ASC', :limit =...
Ruby
class HomeController < ApplicationController end
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 SolarsystemController < ApplicationController end
Ruby
class OfferController < ApplicationController def meep @data = Offer.meep render :layout => false end end
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
# 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| # 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
# 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 require 'net/imap' require 'csv' require 'date' require 'pp' # 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 ...
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
# 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' }]) # Major.create(:name...
Ruby
class AddPageToPost < ActiveRecord::Migration def self.up add_column :posts, :page, :integer end def self.down remove_column :posts, :page end end
Ruby
class CreateComments < ActiveRecord::Migration def self.up create_table :comments do |t| t.string :name t.text :body t.integer :post_id t.timestamps end end def self.down drop_table :comments end end
Ruby
class CreatePosts < ActiveRecord::Migration def self.up create_table :posts do |t| t.string :title t.text :body t.timestamps end end def self.down drop_table :posts end end
Ruby
class CreateAdmins < ActiveRecord::Migration def self.up create_table :admins do |t| t.string :password t.timestamps end end def self.down drop_table :admins end end
Ruby
class AddRecentToPost < ActiveRecord::Migration def self.up add_column :posts, :is_recent, :datetime, :default => false end def self.down remove_column :posts, :is_recent end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class ActiveSupport::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 da...
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../../config/boot', __FILE__) require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/generate'
Ruby
module ContactHelper end
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module AdminHelper end
Ruby
module ColophonHelper end
Ruby
module PostsHelper end
Ruby