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
# Adds support for using object arguments with _.memoize(). | |
nextMemoizeObjKey = 1 | |
memoizeObjectArg = (func) -> | |
_.memoize func, (obj) -> | |
key = obj._memoizeObjKey | |
unless key? | |
key = obj._memoizeObjKey = nextMemoizeObjKey++ | |
key | |
# Example: |
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
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
cd $DIR | |
SELF=`basename $0` | |
SOURCE_BRANCH="master" | |
DEST_BRANCH="gh-pages" | |
TMP_DIR="tmp" |
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 | |
define('COOKIE_FILE', 'cookie.txt'); | |
define('HEADER_REGEX', '#^.*?(\r?\n){2}#msi'); | |
$ch = curl_init(); | |
curl_setopt_array($ch, array( | |
CURLOPT_URL => $assetURL, | |
CURLOPT_POST => FALSE, |
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
require([ | |
"dojo/Deferred" | |
// Add DeferredQueue and DeferredWrapper imports here | |
], function (Deferred, DeferredQueue, DeferredWrapper) { | |
var testDeferred = function () { | |
// Create a wrapper around a callback that returns a deferred object | |
return new DeferredWrapper(function () { | |
// Create a dummy deferred object to finish in 2 seconds | |
var df = new Deferred(); |
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
define([ | |
'dojo/_base/declare', | |
'dojo/_base/lang', | |
'dojo/Deferred' | |
], function (declare, lang, Deferred) { | |
return declare([Deferred], { | |
// summary: | |
// Wraps a function in a dojo.Deferred object. |
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
define([ | |
'dojo/_base/declare', | |
'dojo/_base/lang', | |
'dojo/Deferred', | |
'utility/Log' | |
], function (declare, lang, Deferred, Log) { | |
// Internal ID for more useful logs | |
var queueID = 0; |
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 ($) { | |
function getPositionInfo(elem) { | |
var pos = {}; | |
pos.docViewTop = $(window).scrollTop(); | |
pos.docViewBottom = pos.docViewTop + $(window).height(); | |
pos.elemTop = $(elem).offset().top; | |
pos.elemBottom = pos.elemTop + $(elem).height(); | |
return pos; | |
} |
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
var NewThemeClass = function (config, base) { | |
// Arguments | |
config = Ext.apply({ | |
gradientAngle: 45, | |
gradientDarkerRatio: 0.1 | |
}, config); | |
var i = 0, l, colors, color, | |
seriesThemes, markerThemes, |
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
/** | |
* A Wordpress widget base class which reduces the amount of code needed to create a simple widget with fields. Allows overriding a method adding more complex fields. | |
*/ | |
class Field_Widget extends WP_Widget { | |
private $fields = array(); | |
private $defaults = array(); | |
private $names = array(); | |
function update($new_instance, $old_instance) { |
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
String.prototype.linkify = function(target) { | |
target = typeof target != 'undefined' ? target : ''; | |
return this.replace(/(http(s)?:\/\/(\S)+)/gmi, '<a href="$1" target="' + target + '">$1</a>'); | |
}; | |
"http://www.google.com".linkify() // "<a href="http://www.google.com" target="">http://www.google.com</a>" |
NewerOlder