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 / 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;
});
@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 / 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 / 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 / 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 / .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 / index.js
Created November 19, 2014 15:53
requirebin sketch
var fraktur = require('fraktur');
console.log(fraktur("Fraktur is cool!"));
@Granze
Granze / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-label" noscript>
<template>
<span><content></content></span>
</template>
</polymer-element>
<polymer-element name="my-superlabel" extends="my-label" noscript>
<template>
@Granze
Granze / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
<polymer-element name="my-element">
<template>
@Granze
Granze / designer.html
Created December 2, 2014 21:45
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
<polymer-element name="my-element">
<template>