Skip to content

Instantly share code, notes, and snippets.

View Granze's full-sized avatar
💫
nothing to see here

Maurizio Mangione Granze

💫
nothing to see here
View GitHub Profile
@Granze
Granze / microclearfix.less
Created March 15, 2012 20:38
[LESS] A new micro clearfix
/* http://nicolasgallagher.com/micro-clearfix-hack/ */
.cf {
zoom: 1;
&:before, &:after {
content: "";
display: table;
}
&:after {
clear: both;
@Granze
Granze / Image replacement
Created March 17, 2012 23:18
CSS Image replacement
/* http://nicolasgallagher.com/another-css-image-replacement-technique/ */
.ir {
font: 0/0 a;
text-shadow: none;
color: transparent;
}
@Granze
Granze / box_shadow.less
Created March 21, 2012 22:14
[LESS] Box shadow
.boxShadow(@x : 2px, @y : 2px, @blur : 5px, @spread : 0, @color : rgba(0,0,0,.6)) {
-webkit-box-shadow: @x @y @blur @spread @color;
-moz-box-shadow: @x @y @blur @spread @color;
box-shadow: @x @y @blur @spread @color;
}
@Granze
Granze / text-shadow.less
Created March 25, 2012 21:55
[LESS] Text shadow
.textShadow (@value: 1px 1px 3px rgba(0, 0, 0, .3)) {
text-shadow: @value;
}
@Granze
Granze / gist:2200254
Created March 25, 2012 22:00
[LESS] gradient
.gradient (@startColor: #eee, @endColor: #fff) {
background-color: @startColor;
background: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
background: -webkit-linear-gradient(top, @startColor, @endColor);
background: -moz-linear-gradient(top, @startColor, @endColor);
background: -ms-linear-gradient(top, @startColor, @endColor);
background: -o-linear-gradient(top, @startColor, @endColor);
}
@Granze
Granze / gist:2200257
Created March 25, 2012 22:01
[LESS] Horizontal gradient
.hGradient (@startColor: #eee, @endColor: #fff) {
background-color: @startColor;
background-image: -webkit-gradient(linear, left top, right top, from(@startColor), to(@endColor));
background-image: -webkit-linear-gradient(left, @startColor, @endColor);
background-image: -moz-linear-gradient(left, @startColor, @endColor);
background-image: -ms-linear-gradient(left, @startColor, @endColor);
background-image: -o-linear-gradient(left, @startColor, @endColor);
}
@Granze
Granze / gist:2200261
Created March 25, 2012 22:02
[LESS] Rotate
.rotate (@deg) {
-webkit-transform: rotate(@deg);
-moz-transform: rotate(@deg);
-ms-transform: rotate(@deg);
-o-transform: rotate(@deg);
}
@Granze
Granze / Get URL variables
Created March 25, 2012 22:12
Get URL variables
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
@Granze
Granze / Get URL variables (regex)
Created March 25, 2012 22:24
Get URL variables (regex)
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
@Granze
Granze / A-Z order <ul> items
Created March 25, 2012 22:32
A-Z order <ul> items
var items = $('.to_order li').get();
items.sort(function(a,b){
var keyA = $(a).text();
var keyB = $(b).text();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});
var ul = $('.to_order');