Skip to content

Instantly share code, notes, and snippets.

View gmacdougall's full-sized avatar

Gregor MacDougall gmacdougall

  • Toronto, Ontario, Canada
View GitHub Profile
@gmacdougall
gmacdougall / gist:dbbe2cd68ff9d587c131
Created March 5, 2015 14:46
Giant Spree Dataset
shipping_category = Spree::ShippingCategory.create! name: 'default'
20.times { |i| Spree::StockLocation.create! name: i.to_s }
ActiveRecord::Base.no_touching do
10_000.times do
product = Spree::Product.create! name: SecureRandom.hex, price: 20, shipping_category: shipping_category
rand(1..10).times do
variant = Spree::Variant.create! product: product
variant.stock_items.shuffle.first(rand(1..20)).each { |stock_item| stock_item.update_columns(count_on_hand: rand(1..1000)) }
end
end
Started GET "/products/second-skin-platinum-trunk" for 127.0.0.1 at 2015-07-02 15:07:31 -0400
Spree::Page Exists (0.4ms) SELECT 1 AS one FROM `spree_pages` WHERE `spree_pages`.`visible` = 1 AND ((`spree_pages`.`slug` = 'products/second-skin-platinum-trunk' OR `spree_pages`.`slug` = '/products/second-skin-platinum-trunk')) ORDER BY position ASC LIMIT 1
Processing by Spree::ProductsController#show as HTML
Parameters: {"id"=>"second-skin-platinum-trunk"}
Spree::Order Load (0.4ms) SELECT `spree_orders`.* FROM `spree_orders` WHERE `spree_orders`.`id` = 5360423 AND `spree_orders`.`currency` = 'USD' LIMIT 1
Spree::Adjustment Load (0.3ms) SELECT `spree_adjustments`.* FROM `spree_adjustments` WHERE `spree_adjustments`.`adjustable_type` = 'Spree::Order' AND `spree_adjustments`.`adjustable_id` IN (5360423) ORDER BY spree_adjustments.created_at ASC
Spree::Preference Load (0.2ms) SELECT `spree_preferences`.* FROM `spree_preferences` WHERE `s
results = []
File.foreach('log') do |line|
hash = eval(line.split(' INFO -- : ').last)
results << hash
end
results.select! { |h| h["browsernizer"]["version"] == "39.0.2171.95" }
require 'pry'
binding.pry
anyone: init 1860 ken justin ian
# first auction
# ken starts
ken: bid 20
justin: bid 25
ian: bid 30
ken: bid 40
justin: bid 45
ian: bid 50
ken: bid 55
@gmacdougall
gmacdougall / spree.rb
Created September 10, 2015 09:27
Turn off Spree Alerts
# config/initializers/spree.rb
Spree.config do |config|
config.check_for_spree_alerts = false
end
# config/initializers/reimbursement_hook.rb
Rails.application.config.to_prepare do
Spree::Reimbursement.reimbursement_success_hooks = [
->(reimbursement) { puts reimbursement }
]
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<html><body>
<svg
xmlns="http://www.w3.org/2000/svg"
height="152"
width="176">
<polygon points="44,0 132,0 176,76 132,152 44,152 0,76" fill="yellow"/>
<text
@gmacdougall
gmacdougall / -
Created September 25, 2015 13:14
2015-09-25 08:38:01 --> gem (65bb8d45@gateway/web/freenode/ip.101.187.141.69) has joined #solidus.io
2015-09-25 08:38:47 gem Hi Solidus dudes, few questions from a merchant if you don't mind...
2015-09-25 08:44:36 gmacdougall gem: go for it
2015-09-25 08:46:49 gem Thank you! Ok, Multi-Store...we currently have setup easypost for our shipping labels etc, but this would only be for AU and need to setup a 3PL (like Shipwire) for USA store...is this as simple as setting up different shipping methods? As I don't see option to pick 'zones' in the store & domains options
2015-09-25 08:48:18 gmacdougall do you want to sell this through a different domain?
2015-09-25 08:48:36 gmacdougall exampe: store.com vs. store.com.au?
2015-09-25 08:50:16 gem hmmm...I am not sure what is best practice..a different domain or subdomain i.e. store.com and store.com/au or au.store.com
2015-09-25 08:50:38 gem that might be a question for the marketing/seo experts
2015-09-25 08:50:53 gmacdougall are they going to be selling the same s
RSpec.describe 'test' do
it 'compares with eq' do
expect(BigDecimal.new('19.99')).to eq BigDecimal.new('19.99')
end
class Foo
def price
BigDecimal.new('19.99')
end
end