This file contains hidden or 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
/** | |
* Swiper jQuery Plugin | |
* | |
* You need to also include: | |
http://www.netcu.de/jquery-touchwipe-iphone-ipad-library | |
* | |
* @code | |
* <script> | |
* $('.track').swiper({ | |
* 'trainClass': 'train', |
This file contains hidden or 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
/** | |
* Convert iframes to divs via ajax iframe_to_div jQuery Plugin | |
* | |
* Uses javascript to replace iframes with divs containing their source content | |
* by loading via ajax. If you use this to load vanilla html snippets, this has the | |
* effect of applying the page's css to your vanilla html snippet. | |
* | |
* This will not work if the iframe src is not a relative link due to ajax restrictions across domains. | |
* | |
* As an example: |
This file contains hidden or 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
/** | |
* HTML5 Media Resume Playback (Playhead Position Memory) jQuery Plugin | |
* | |
* Remembers the playback position of media and resumes on page load. The | |
* playhead position is set on the media events: play, pause, and seeked; as | |
* well the position is recorded at an interval defined in the options, anytime | |
* the media is playing. | |
* | |
* Requires the jStorage plugin <http://www.jstorage.info/> | |
* |
This file contains hidden or 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 jQuery Plugin to fade in multiple DOM elements in step-wise succession. | |
* | |
* @param bool|object options | |
* A boolean value will be interpreted as {start: [value]}. | |
* An object with these properties: | |
* - speed int How fast to reveal the step in seconds. Each element may also | |
control it's individual speed with the attribute data-speed. | |
* - delay int Defaults to 0. How many seconds between the end of one step and | |
the start of the next. You may also use data-delay for element specific |
This file contains hidden or 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
/** | |
* Convert all element properties to children | |
* | |
* @param array $array An array with one or more keys that begine with '#' . | |
* | |
* @return array Any key that began with '#' will have the # stripped. | |
*/ | |
function element_properties_to_children($array) { | |
$keys = array_map(create_function('$item', 'return substr($item, 1);'), array_keys($array)); | |
This file contains hidden or 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
/** | |
* Set a multidimensional array element based on an array of nested keys. | |
* | |
* @code | |
* $vars = array(); | |
* $string = 'some.string.of.keys'; | |
* $keys = explode('.', $string); | |
* $value = 'final value'; | |
* array_set_nested_element($vars, $keys, $value); | |
* @endcode |
This file contains hidden or 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 | |
/** | |
* Shows how to create a field that controls node access in Drupal 7 based | |
* on callback functions using the node access API and a field select list; | |
* so that content managers can easily control per-entity access control | |
* using a simply dropdown. | |
* | |
* 1. Create a custom module and insert the following 3 functions. | |
* 2. Create a List(text) field called field_access with widget select and | |
* attach it to the entity where you want to control access. |
This file contains hidden or 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
/** | |
* Checks one or more render arrays for any visible content. | |
* | |
* @param ... array One or more renderable arrays. | |
* | |
* @return bool | |
*/ | |
function my_theme_has_content() { | |
$build = func_get_args(); |
This file contains hidden or 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
/** | |
* Implements hook_js_alter(). | |
* | |
* Replace the system-provided jquery with our own higher version for the theme. | |
*/ | |
function my_theme_js_alter(&$javascript) { | |
// Go through and replace the jquery that is being provided by the system | |
// with out own higher version for the theme. We use an array | |
// here in case the jquery update module is/is not being used. |
This file contains hidden or 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 | |
/** | |
* Determine if an image is mostly dark. | |
* | |
* @param string $uri The uri of the image file. | |
* @param array $options | |
* - resolution int The larger the number the more measurements will be taken | |
* and the longer it will take. Defaults to 10. | |
* - threshold int The luminance threshold. 170 is equal to #acacac. | |
* @param array $info Pass an array to be filled with data used to calculate |