This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://blog.arkency.com/two-ways-for-testing-preloading-eager-loading-of-activerecord-association-in-rails/ | |
https://github.com/monterail/rspec-query-limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started GET "/api/orders" for 127.0.0.1 at 2018-12-15 12:15:07 +0100 | |
Processing by Spree::Api::OrdersController#index as JSON | |
Spree::User Load (0.4ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."spree_api_key" = ? LIMIT ? [["spree_api_key", "3ce7a74a880861657c1e8586e7d7516aee7808467660e71b"], ["LIMIT", 1]] | |
↳ /Users/kennyadsl/Code/nebulab/solidus/api/app/controllers/spree/api/base_controller.rb:46 | |
(0.2ms) SELECT "spree_roles"."name" FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = ? [["user_id", 1]] | |
↳ /Users/kennyadsl/Code/nebulab/solidus/api/app/controllers/spree/api/base_controller.rb:61 | |
Spree::Role Load (0.2ms) SELECT "spree_roles".* FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = ? [["user_id", 1]] | |
↳ /Users/kennyadsl/Code/nebulab/solidus/core/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
data = File.read("CHANGELOG.md") | |
versions = [] | |
data.scan(/## Solidus ([0-9\.]+)\.0 \(([0-9]+)-([0-9]+)-([0-9]+)\)/) do | |
version = $1 | |
release_date = Date.new($2.to_i, $3.to_i, $4.to_i) | |
eol = [release_date >> 18, Date.new(2018, 05, 05)].max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Oh-My-Zsh : Nico Theme (https://gist.github.com/ntarocco/3027ed75b6e8fc1fd119) | |
# Modified by : Carlos Cuesta | |
eval red='$FG[203]' | |
eval green='$FG[184]' | |
eval yellow='$FG[220]' | |
eval blue='$FG[075]' | |
eval magenta='$FG[161]' | |
eval cyan='$FG[037]' | |
eval white='$FG[231]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/spree/custom_ability.rb | |
module Spree | |
class CustomAbility | |
include CanCan::Ability | |
def initialize(user) | |
can [:action], Spree.user_class, id: user.id | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Flexible background positioning | |
* via extended background-position | |
*/ | |
div { | |
background: url(http://csssecrets.io/images/code-pirate.svg) | |
no-repeat #58a; | |
background-position: calc(100% - 20px) calc(100% - 10px); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Multiple borders | |
*/ | |
div { | |
width: 100px; | |
height: 60px; | |
margin: 25px; | |
background: yellowgreen; | |
border: 10px solid #655; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Devices sizes */ | |
$tablet-width: 768px; | |
$mobile-width: 420px; | |
/* Responsive breakpoints */ | |
$break-small: $mobile-width; | |
$break-large: $tablet-width; | |
@mixin respond-to($media) { | |
@if $media == mobile { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_to_cart(name, variant=nil) | |
visit spree.root_path | |
click_link name | |
# in the product page | |
choose variant if variant | |
click_button "add-to-cart-button" | |
end | |
def complete_checkout_with_login(email, password) | |
begin_checkout |
NewerOlder