Skip to content

Instantly share code, notes, and snippets.

View rthbound's full-sized avatar

Ryan T. Hosford rthbound

View GitHub Profile
Errno::ECONNREFUSED (Connection refused - connect(2)):
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:560:in `initialize'
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:560:in `open'
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:560:in `connect'
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:553:in `do_start'
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:542:in `start'
/home/tad/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/net/http.rb:1035:in `request_without_newrelic_trace'
rsolr (1.0.6) lib/rsolr/connection.rb:15:in `execute'
rsolr (1.0.6) lib/rsolr/client.rb:163:in `execute'
rsolr (1.0.6) lib/rsolr/client.rb:158:in `send_and_receive'
source "http://gems.github.com"
source "http://rubygems.org"
gem 'sitemap_generator'
gem 'rails', '2.3.12'
gem 'binarylogic-authlogic', '2.1.1', :require => "authlogic"
gem 'binarylogic-searchlogic', :require => "searchlogic"
gem 'andand', '1.3.1'
gem 'alchemist', '0.1.2.1'
gem 'calendar_date_select', '1.16.2'
ll of this relates to the all_parts_auto repo
In general, there should be Site model in the app to handle most of the needs:
Site
+ title:string
+ domain:string (add an index to this)
+ stylesheet_path (logos will all be put into public, stylesheets will reference them)
+ authnet_user:string
+ authnet_pass:string
boost(10) { with(:quantity).greater_than 0 }
with :quantity, 0
#if params["number"].present? && params["number"].split(" ").count >= 2
# @part_number = exact_match_by_number_and_line_code(params["number"]) if params["number"] && params[:interchange] != "false"
#end
filter
@part_number = @part_numbers.first if params[:number].split(" ").map{|x| PartNumber.find_by_number(x)}.any?
production:
solr:
hostname: localhost
port: 8983
log_level: WARNING
development:
solr:
hostname: localhost
port: 8982
@rthbound
rthbound / front.rb
Created April 13, 2012 21:22
front end for quiz?
class Question
attr_accessible :qstring, :active
has_many :answer_choices
end
class AnswerChoice
attr_accessible :astring, :img_url, :question_id
belongs_to :question
has_many :impacts
has_many :answer_selections
@rthbound
rthbound / snip.rb
Created April 24, 2012 22:46
snip.rb
consumer = OAuth::Consumer.new(ckey, csecret, :realm => "http://www.opentable.com", :oauth_signature_method => "HMAC-SHA1", :site=> "https://secure.opentable.com", :request_token_path => "", :authorize_path => "", :access_token_path=> "", :http_method => :get)
consumer.http.set_debug_output($stderr)
access_token = OAuth::AccessToken.new consumer
res = access_token.get('/api/otapi_v2.ashx/restaurant?pid=1049&rid=82591')
@rthbound
rthbound / migration.rb
Created April 26, 2012 12:52
migrate.rb
class CreateEanImages < ActiveRecord::Migration
def change
create_table(:ean_images, :id => false) do |t|
t.integer :hotel_id
t.text :name
t.string :caption
t.string :url
t.string :supplier
t.integer :width
t.integer :height
FILENAME = ENV["HOTEL_IMAGES"] || "HotelImageList.txt"
def images_for(hotel)
IO.foreach(FILENAME).map do |line|
split = line.split("|")
if hotel.id.to_i == split[0].to_i
Suitcase::Image.new({
"caption" => split[1],
"url" => split[2],
"thumbnailUrl" => split[6],