Skip to content

Instantly share code, notes, and snippets.

View kennyadsl's full-sized avatar
❤️
Ruby

Alberto Vena kennyadsl

❤️
Ruby
View GitHub Profile
@kennyadsl
kennyadsl / credits.txt
Created January 2, 2019 14:05
Query count RSpec
https://blog.arkency.com/two-ways-for-testing-preloading-eager-loading-of-activerecord-association-in-rails/
https://github.com/monterail/rspec-query-limit
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
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
# 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]'
# 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
@kennyadsl
kennyadsl / dabblet.css
Created November 29, 2015 11:48 — forked from csssecrets/dabblet.css
Flexible background positioning
/**
* 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);
@kennyadsl
kennyadsl / dabblet.css
Created November 29, 2015 10:41 — forked from anonymous/dabblet.css
Multiple borders
/**
* Multiple borders
*/
div {
width: 100px;
height: 60px;
margin: 25px;
background: yellowgreen;
border: 10px solid #655;
commit 87e14e7ce3ffac5be0f32248cd2505c8e3ebf60d
Author: Alberto Vena <kennyadsl@gmail.com>
Date: Wed Apr 8 20:21:53 2015 +0200
adds intial work to allow better theming
diff --git a/theme_sample/cart.html b/theme_sample/cart.html
index 459054c..be26636 100644
--- a/theme_sample/cart.html
+++ b/theme_sample/cart.html
@kennyadsl
kennyadsl / better_diff3
Created May 26, 2014 09:19
Simple script to find difference in 3 projects which share same file names
#!/bin/bash
# change proj_1 proj_2 and proj_3 with real project names
# usage:
# $ better_diff3 Gemfile.lock
#
args=("$@")
diff3 '~/Code/proj_1/'${args[0]} '~/Code/proj_2/'${args[0]} '~/Code/proj_3/'${args[0]}

Keybase proof

I hereby claim:

  • I am kennyadsl on github.
  • I am kennyadsl (https://keybase.io/kennyadsl) on keybase.
  • I have a public key whose fingerprint is CA42 C69E A2DA 1F88 0919 7332 4252 BCEB 472C 0ECF

To claim this, I am signing this object: