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
$.fn.visible = function() { | |
'use strict'; | |
var $window = $(window), | |
windowScrollTop = $window.scrollTop(), | |
windowHeight = $window.height(); | |
return this.filter(function() { | |
var $this = $(this), | |
thisOffsetTop = $this.offset().top, |
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 | |
$idMap = []; | |
function json2sql($current, $parent, $json) { | |
global $idMap; | |
$table = ""; | |
$insert = ""; | |
$children = ""; |
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 Autocomplete = function(element, suggestions) { | |
'use strict'; | |
/** | |
* Variables | |
*/ | |
var container = document.createElement('div'); | |
var list = document.createElement('ul'); | |
var listItems = []; | |
var current = []; |
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
/** | |
* Plugin to reduce a set of elements to those | |
* visible in the viewport | |
* | |
* @param {Object} | |
* @param {Function} | |
* @param {Function} | |
* @return {jQuery} | |
*/ | |
(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
$.fn.observe = function(callback, options) { | |
options = options || { | |
attributes: true, | |
childList: true, | |
characterData: true | |
}; | |
$(this).each(function() { | |
var observer = new MutationObserver(callback.bind(this)); | |
observer.observe(this, options); |
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($) { | |
$.fn.watch = function(callback, once) { | |
var options = { | |
childList: true, | |
subtree: true | |
}; | |
var _callOnNode = 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
window._ = function() {console.log(...arguments)}; |
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 | |
/** | |
* Optional convenience class. Objects extending the | |
* StateHandler class can register with a StateArchivist | |
* instance; then calling remember() or restore() on the | |
* archivist will be propagated to all registered objects. | |
*/ | |
class StateArchivist { | |
/** |
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
/** | |
* Get an array (!) of elements in a given context | |
*/ | |
const find = (selector, context) => | |
Array.from((context || document).querySelectorAll(selector)); | |
/** | |
* Create a new element and optionally initialize it | |
* with some content and attributes | |
*/ |
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 | |
/** | |
* Return the reference to an element/subarray | |
* of an array, specified by a key array | |
* | |
* @param array &$array Array to access by reference | |
* @param mixed $keys Array of the keys | |
* @return mixed Reference to the match | |
*/ | |
function &array_access(&$array, $keys) { |
OlderNewer