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 strict'; | |
define(function() { | |
/** | |
* Returns a function, that, as long as it continues to be invoked, will not | |
* be triggered. The function will be called after it stops being called for | |
* N milliseconds. If `immediate` is passed, trigger the function on the | |
* leading edge, instead of the trailing. | |
*/ | |
var debounce = function(func, wait, immediate) { | |
var timeout; |
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
/* | |
* classList.js: Cross-browser full element.classList implementation. | |
* 2014-07-23 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ | |
/*global self, document, DOMException */ |
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
/** | |
* Prepend a namespace in WordPress body_class() function | |
* @param string $prefix The desired prefix | |
* @param string $classes Additional classes separated by single space | |
* @return string Single space separated list of classes | |
*/ | |
function body_class_prefix($prefix, $classes = '') | |
{ | |
global $wp_query; | |
$output = ''; |
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(function() { | |
/** | |
* Get the closest element of a given element by class | |
* | |
* Take an element (the firt param), and traverse the DOM upward from it | |
* untill it hits the element with a given class name (second parameter). | |
* This mimics jquery's `.closest()`. | |
* | |
* @param {element} el The element to start from | |
* @param {string} clazz The class name |
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 recursive function to parse a multidimensional array from a string | |
* | |
* @param array $delimiter Array of delimiters | |
* @param string $string The string to parse | |
* @return array Multidimensional array | |
*/ | |
function n26_multi_explode(array $delimiter, $string) { | |
// Shift the array | |
$d = array_shift($delimiter); |
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 recursive function to parse a multidimensional array from a string |
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 strict'; | |
define(function () { | |
var substitute = {}; | |
substitute.placeholders = function (target, replaceObject) { | |
_replaceStuff(target, replaceObject, 'placeholders'); | |
}; | |
substitute.attribute = function (target, replaceObject) { |
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
env: | |
browser: true | |
rules: | |
brace-style: [2, "stroustrup", { "allowSingleLine": true }] | |
comma-style: [2, "last"] | |
default-case: 2 | |
# func-style: [2, "expression"] | |
guard-for-in: 2 | |
indent: [2, 4, {"SwitchCase": 1}] |
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
linters: | |
SelectorFormat: | |
enabled: true | |
convention: strict_BEM | |
Indentation: | |
enabled: true | |
width: 4 | |
ColorKeyword: |
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
/** | |
* Call an API | |
* | |
* @param string $method HTTP verb: POST, PUT, GET etc | |
* @param stinrg $url URL | |
* @param boolean $data Plunk the data tot he URL: array("param" => "value") ==> index.php?param=value | |
* @return request Whatever the API returns | |
*/ | |
function n26_call_api($method, $url, $data = false) { | |
$curl = curl_init(); |
NewerOlder