Skip to content

Instantly share code, notes, and snippets.

View LeonardoCiaccio's full-sized avatar

Leonardo Ciaccio LeonardoCiaccio

View GitHub Profile
@LeonardoCiaccio
LeonardoCiaccio / Trimgle.Test.JSON.json
Last active September 15, 2017 11:52
Trimgle, test JSON, nuova feature
{"first":[1,2,3,{"worng key \/ * standard":[1,2,3],"another key":"my value"}],"second":{"only":1}}
@LeonardoCiaccio
LeonardoCiaccio / _isObj.js
Created September 15, 2017 07:37
Controllo se è un oggetto
function _isObj( _obj ){
return ( typeof _obj === "object" && JSON.stringify( _obj ).indexOf( "{" ) == 0 );
}
@LeonardoCiaccio
LeonardoCiaccio / Trimgle.Last.News.json
Last active September 30, 2017 17:26
Trimgle Last News
{"lastNews":"https://github.com/LeonardoCiaccio/Trimgle/wiki/ChangeLog"}
@LeonardoCiaccio
LeonardoCiaccio / _noCache.js
Created September 8, 2017 10:46
Rende un link sempre nuove quindi non restituisce la cache in una chiamata xhr
var _noCache = function( link ){
var newdata = Date.now();
if( link.indexOf( "?" ) > -1 ){
return link.replace( "?", "?" + newdata + "=" + newdata + "&" );
}else if( link.indexOf( "#" ) > -1 ){
@LeonardoCiaccio
LeonardoCiaccio / uSignature.bookmarklet.js
Created August 13, 2017 11:59
Universal Signature ( uSignature )
/*
Puoi creare il bookmarklet utilizzando questo servizio https://chriszarate.github.io/bookmarkleter/
*/
// --> [ uSignature lib ]

Keybase proof

I hereby claim:

  • I am LeonardoCiaccio on github.
  • I am leonardociaccio (https://keybase.io/leonardociaccio) on keybase.
  • I have a public key whose fingerprint is 10FE 31E1 3353 615F D730 8099 2D8C D687 27B9 CBCD

To claim this, I am signing this object:

@LeonardoCiaccio
LeonardoCiaccio / _similar.js
Last active September 13, 2017 13:43
Esegue un confronto tra 2 testi e ne restituisce la percentuale di similitudine
function similar_text (first, second, percent, limit) {
// eslint-disable-line camelcase
// discuss at: http://locutus.io/php/similar_text/
// original by: Rafał Kukawski (http://blog.kukawski.pl)
// bugfixed by: Chris McMacken
// bugfixed by: Jarkko Rantavuori original by findings in stackoverflow (http://stackoverflow.com/questions/14136349/how-does-similar-text-work)
// improved by: Markus Padourek (taken from http://www.kevinhq.com/2012/06/php-similartext-function-in-javascript_16.html)
// example 1: similar_text('Hello World!', 'Hello locutus!')
// returns 1: 8
@LeonardoCiaccio
LeonardoCiaccio / _class.js
Created August 2, 2017 14:51
Aggiunge un attributo con un valore shared, utile per distinguere elementi con struttura uguale
/*
Version : 1.0.0
Aggiunge un attributo shared dinamico a seconda delle opzioni, molto utile per avere riferimenti shared
vuol dire che più di un elemento può avere lo stesso valore:
window._class( {
selector : "signature" // default "_class"
@LeonardoCiaccio
LeonardoCiaccio / _id.js
Last active August 2, 2017 14:28
Aggiunge un attributo univoco a seconda delle opzioni
/*
Version : 1.0.0
Aggiunge un attributo univoco dinamico a seconda delle opzioni, molto utile per fare
una istantanea della pagina e avere riferimenti solidi :
window._id( {
selector : "signature" // --> default "_id"
// Request storage usage and capacity left
window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.TEMPORARY,
//the type can be either TEMPORARY or PERSISTENT
function(used, remaining) {
console.log("Used quota: " + used + ", remaining quota: " + remaining);
}, function(e) {
console.log('Error', e);
} );