Skip to content

Instantly share code, notes, and snippets.

View cmar's full-sized avatar

Chris Mar cmar

  • CustomInk
  • Northern, VA
  • X @cmar
View GitHub Profile
FactoryGirl.define do
factory :user do
first_name "Fox"
last_name "Mulder"
sequence(:email) { |n| "fox#{n}@xfiles.com"}
password "XXXXX111111"
factory :admin do |admin|
admin.after_create { |admin| admin.roles << Factory(:admin_role) }
end
{"name":"awesomeshop-39311","cmd":"cd /data/spree/current && bundle exec rake spree_shared:bootstrap['awesomeshop-39311']","output":"Creating database: awesomeshop-39311\nLoading seed & sample data into database: awesomeshop-39311\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/core/db/default/spree/countries.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/core/db/default/spree/roles.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/core/db/default/spree/states.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/core/db/default/spree/zone_members.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/core/db/default/spree/zones.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-7f458cf6f9f6/sample/lib/tasks/../../db/sample/spree/addresses.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.
{"name":"awesomeshop-37722","cmd":"cd /data/spree/current && bundle exec rake spree_shared:bootstrap['awesomeshop-37722']","output":"Creating database: awesomeshop-37722\nLoading seed & sample data into database: awesomeshop-37722\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/core/db/default/spree/countries.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/core/db/default/spree/roles.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/core/db/default/spree/states.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/core/db/default/spree/zone_members.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/core/db/default/spree/zones.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.1/bundler/gems/spree-27bca97223aa/sample/lib/tasks/../../db/sample/spree/addresses.yml\nloading fixture /data/spree/shared/bundle/ruby/1.9.
@cmar
cmar / gist:2776742
Created May 23, 2012 18:08
TaxCloud Test Script
require "savon"
cart_id = rand(9999)
order_id = rand(9999)
api_login_id = '1B3D4440'
api_key = '77CE20A3-0805-4A3D-BF36-AD7FC4D39BA0'
# create a client for your SOAP service
client = Savon::Client.new("https://api.taxcloud.net/1.0/?wsdl")
puts client.wsdl.soap_actions
@cmar
cmar / gist:2829864
Created May 29, 2012 18:20
View Paths
def show
Rails.logger.debug('*' * 100)
Rails.logger.debug(self.view_paths.inspect)
Rails.logger.debug('*' * 100)
Rails.logger.debug(ApplicationController.view_paths.inspect)
Rails.logger.debug('*' * 100)
@product = find_product(params[:id])
end
@cmar
cmar / quiet_assets.rb
Created June 6, 2012 19:11
Hide Asset Log Messages
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/spraycan/}
call_without_quiet_assets(env)
ensure
Rails.logger.level = previous_level
@cmar
cmar / .irbrc
Created June 11, 2012 17:25
irbrc to auto switch rails console
# store_works Apartment Switching
if defined? Rails
if defined? Apartment::Database
def switch(store)
Apartment::Database.switch(store)
ENV['INTERNAL_SUBDOMAIN'] = store
puts "=> Switching to #{store}"
end
class << self
Spree::ShippingCategory Load (0.4ms) SELECT `spree_shipping_categories`.* FROM `spree_shipping_categories` WHERE `spree_shipping_categories`.`id` = 727197603 LIMIT 1
Spree::ItemRate Load (4.4ms) SELECT `spree_item_rates`.* FROM `spree_item_rates` WHERE `spree_item_rates`.`rateable_id` = 727197603 AND `spree_item_rates`.`rateable_type` = 'Spree::ShippingCategory'
Spree::Zone Load (0.4ms) SELECT `spree_zones`.* FROM `spree_zones` WHERE `spree_zones`.`id` = 9 LIMIT 1
Spree::Country Load (0.5ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 214 LIMIT 1
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 35 LIMIT 1
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 13 LIMIT 1
Spree::Country Load (0.4ms) SELECT `spree_countries`.* FROM `spree_countries` WHERE `spree_countries`.`id` = 20 LIMIT 1
Spree::Country Load (0.5ms) SELECT `spree_countrie
@cmar
cmar / gist:4154114
Created November 27, 2012 12:55
shipment notificaiton
<?xml version="1.0" encoding="UTF-8"?>
<DeliveryConfirmations xmlns:pchBase="http://schema.pchintl.com/pchBase_v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Action="Read" xsi:noNamespaceSchemaLocation="SC_1.0.xsd">
<SC>
<SRef>
<RefV>B2C</RefV>
<RefQ>OrderType</RefQ>
</SRef>
<DN>50aa899205ffbb257e00000f_H438105531460</DN>
<AWB>UPSSAVER006</AWB>
<Car>UPSG-SAVER</Car>
@cmar
cmar / migrations
Created November 29, 2012 16:45
Tax Cloud Spree Integration
class CreateSpreeTaxCloudTransactions < ActiveRecord::Migration
def change
create_table :spree_tax_cloud_transactions do |t|
t.references :order
t.string :message
t.timestamps
end
add_index :spree_tax_cloud_transactions, :order_id
end
end