Skip to content

Instantly share code, notes, and snippets.


Andrea Ercolino aercolino

View GitHub Profile
aercolino / gist:5301378
Created Apr 3, 2013
Shuffle option added to the Flickr Feed plugin.
View gist:5301378
'date_format' => get_option('date_format'),
'count' => 10,
'shuffle' => 0,
'sort' => null,
return garees_flickr_feed_error("please enter your flickr-api-key in the settings!");
$amount = $shuffle >= $count ? $shuffle : $count;
aercolino / $.proxyGet.js
Last active Aug 29, 2015
A jQuery plugin for accessing any URL, using YQL or another proxy.
View $.proxyGet.js
$.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;
aercolino / $.equals.js
Created Jun 7, 2014
A jQuery plugin for equality comparisons of JavaScript scalars and objects.
View $.equals.js
$.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',
View $.news.js = (function($) {
var broker = $({});
return {
subscribe: function() {
$.fn.on.apply(broker, arguments);
unsubscribe: function() {
aercolino / flickr_feed.php
Created Jun 30, 2014
Small changes to make "Garees Flickr Feed" WordPress plugin survive Flickr https only API.
View flickr_feed.php
if(!defined('GAREE_MUSTACHEPHP')) {
define('GAREE_MUSTACHEPHP', true);
function flickr_api($path = '') {
return '' . $path;
aercolino / enzymes-hello-world.php
Last active Aug 29, 2015
This is a test for exploring Gists as Enzymes
View enzymes-hello-world.php
echo 'Hello World!';
aercolino / checked_overloading.php
Last active Aug 29, 2015
Proof of concept for WordPress bug #30891: Unchecked property overloading is detrimental to OOP.
View checked_overloading.php
// Proof of concept for WordPress bug #30891: Unchecked property overloading is detrimental to OOP.
class CheckedOverloading {
public $legacy_public = 'legacy_public';
protected $legacy_protected = 'legacy_protected';
private $legacy_private = 'legacy_private';
public $fresh_public = 'fresh_public';
aercolino / php_lint.php
Created Jan 23, 2015
A function for checking the syntax of PHP code.
View php_lint.php
* Check the syntax of a code snippet.
* @param $code
* @return mixed|null|string
function php_lint( $code )
$result = null;
View WP tmp API example
TEMPORARY DIRECTORY: This is where plugin / theme authors can store temporary files and directories. When a temporary directory expires, the garbage collector will delete it.
* '''tmp_dir_create'''( $expiration, $primary_file )
* ==> string $absolute_path | WP_Error $error
* Create a temporary directory specifically for the plugin/theme defined by $primary_file.
* '''tmp_dir_info'''( $absolute_path, $with_listing = false )
* ==> array $tmp_info | WP_Error $error
* Get info about the temporary directory at $absolute_path.
aercolino / #nzymes
Last active Mar 16, 2016
#nzymes Table of Contents: add one to any page
View #nzymes

Table of Contents: add one to any page

These are my enzymes for the table of contents shown at

See Example 1: table-of-contents;example-1

This setup allows a post author to easily create and maintain a table of contents straight into the visual editor of a page. (See table-of-contents; and table-of-contents; At the same time, the table of contents can be added to any other WordPRess place, so that it's shown when the context of that place is rendered by WordPress. (See table-of-contents;example-1.html)