Skip to content

Instantly share code, notes, and snippets.

View mvidaurre's full-sized avatar

Manuel Vidaurre mvidaurre

View GitHub Profile
@mvidaurre
mvidaurre / gist:bf7c491b3a45e422f3d3
Created October 24, 2014 06:32
Rails Development Server Console Output
Started GET "/checkout" for 127.0.0.1 at 2014-10-24 01:25:31 -0500
Processing by Spree::CheckoutController#edit as HTML
Spree::Store Load (0.6ms) SELECT "spree_stores".* FROM "spree_stores" WHERE (url like '%localhost%') ORDER BY "spree_stores"."id" ASC LIMIT 1
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = 't' ORDER BY "spree_stores"."id" ASC LIMIT 1
Spree::Order Load (1.3ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."completed_at" IS NULL AND "spree_orders"."currency" = 'MXN' AND "spree_orders"."guest_token" = 'iBU58pwSD_OWSgCu5s18DA' AND "spree_orders"."store_id" = 1 AND "spree_orders"."user_id" IS NULL LIMIT 1 FOR UPDATE
Spree::Adjustment Load (0.4ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_type" = 'Spree::Order' AND "spree_adjustments"."adjustable_id" IN (23) ORDER BY spree_adjustments.created_at ASC
@order.bill_address before @order.with_lock: nil
(0
@mvidaurre
mvidaurre / product_factory.rb
Created July 14, 2014 01:28
Adding create attached images in Product Factory
after(:create) do |product|
image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
product.images.create!(attachment: image)
end
@mvidaurre
mvidaurre / fibo_tail_recursion.rb
Created April 17, 2014 19:30
Calculate the nth Fibonacci number, f(n). Using invariants for https://github.com/RayHightower/fibonacci
# Calculate the nth Fibonacci number, f(n). Using invariants
def fibo_tr(n, acc1, acc2)
if n == 0
0
elsif n < 2
acc2
else
return fibo_tr(n - 1, acc2, acc2 + acc1)
end
end