Skip to content

Instantly share code, notes, and snippets.

View aercolino's full-sized avatar

Andrea Ercolino aercolino

View GitHub Profile
@aercolino
aercolino / $.equals.js
Created June 7, 2014 12:08
A jQuery plugin for equality comparisons of JavaScript scalars and objects.
$.equals = function( a, b, options ) {
options = $.extend({
// if true, in case of inequality, a trace of the first difference is logged to the console
verbose: false,
// use 'strict' for ===, 'abstract' for ==
comparison: 'strict',
@aercolino
aercolino / $.proxyGet.js
Last active August 29, 2015 14:02
A jQuery plugin for accessing any URL, using YQL or another proxy.
$.proxyGet = function ( url, callback, options ) {
// reject anything that doesn't resemble a "plain" URL or a null (see below)
if (! (url === null || /^(https?:|\/\/)/.test(url))) {
throw new SyntaxError('Expected a URL.');
}
// allow detection of current SSL mode by starting the url with '//'
if (url && url.indexOf('//') === 0) {
url = window.location.protocol + url;