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 / .editorconfig
Created November 27, 2013 23:53
Editor config basic template
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@Granze
Granze / package.json
Created November 26, 2013 17:51
Basic package.json template
{
"name": "appName",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.2",
"load-grunt-tasks": "~0.2.0"
}
}
@Granze
Granze / npm list without dependecies.sh
Created November 14, 2013 10:50
npm list without dependencies function
function npmls() { npm ls -g --depth=0 "$@" 2>/dev/null }
@Granze
Granze / Automatic deploy based on git branch
Created September 27, 2012 12:44
Automatic deploy based on git branch
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
git --work-tree=/var/www/prod checkout -f $branch
echo 'Changes pushed live.'
fi
@Granze
Granze / Check if an image is loaded.js
Created March 25, 2012 22:40
Check if an image is loaded
$('#theImage').attr('src', 'image.jpg').load(function() {
alert('This Image Has Been Loaded');
});
@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: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 / 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 / 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 / Find the index of an element in <ul>.js
Created March 25, 2012 22:36
Find the index of an element in <ul>
$("ul > li").click(function () {
var index = $(this).prevAll().length;
});