This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.news = (function($) { | |
var broker = $({}); | |
return { | |
subscribe: function() { | |
$.fn.on.apply(broker, arguments); | |
}, | |
unsubscribe: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
if(!defined('GAREE_MUSTACHEPHP')) { | |
include_once('Mustache.php'); | |
define('GAREE_MUSTACHEPHP', true); | |
} | |
function flickr_api($path = '') { | |
return 'https://api.flickr.com' . $path; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Hello World!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check the syntax of a code snippet. | |
* | |
* @param $code | |
* | |
* @return mixed|null|string | |
*/ | |
function php_lint( $code ) | |
{ | |
$result = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
'date_format' => get_option('date_format'), | |
'count' => 10, | |
'shuffle' => 0, | |
'sort' => null, | |
//... | |
else | |
return garees_flickr_feed_error("please enter your flickr-api-key in the settings!"); | |
$amount = $shuffle >= $count ? $shuffle : $count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function IndentationToList(options) { | |
'use strict'; | |
return Main(options); | |
function Interpolate(template, variables) { | |
var names = Object.keys(variables); | |
var result = template; | |
for (var i = 0, iTop = names.length; i < iTop; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer