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 / Jquery Check MediaQuery
Created July 25, 2011 08:12
Check mediaquery with jquery
if (window.matchMedia('only screen and (max-device-width: 480px)').matches) {
// Asynchronously load iphone.js
} else if (window.matchMedia('only screen and (min-device-width: 481px) and ' +
'(max-device-width: 1024px) and ' +
'(orientation: portrait)').matches) {
// Asynchronously load ipad-portrait.js
}
@kennyadsl
kennyadsl / checkout_helper.rb
Created July 5, 2012 12:14
Spree Checkout Rspec helper
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
@kennyadsl
kennyadsl / admin.png
Created October 5, 2012 14:37
spree admin interface
admin.png
@kennyadsl
kennyadsl / Scss-responsive-mixin
Created December 11, 2012 14:49
Scss responsive mixin
/* 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 {

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:

@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]}
commit 87e14e7ce3ffac5be0f32248cd2505c8e3ebf60d
Author: Alberto Vena <[email protected]>
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 / 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;
@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);
# 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