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 the first image inserted into a post body | |
*/ | |
function get_first_inserted_image() | |
{ | |
global $post, $posts; | |
preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); | |
$first_img = $matches [1] [0]; | |
// Spew it out as an imege | |
$first_img = '<img alt="Blog Post Image" src="' . $first_img . '">'; |
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
/** | |
* Lazy load images inserted into the post body | |
* @link http://wptheming.com/2013/03/lazy-loading-images/ | |
*/ | |
function add_image_placeholders($content) | |
{ | |
// Don't lazyload for feeds | |
if (is_feed()) { | |
return $content; | |
} |
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
/** | |
* Prints out array in human readable form, just a helper function | |
* @param array $arr The wanted array to be printed | |
* @return array The array in human readable form | |
*/ | |
function printr_func($arr) | |
{ | |
echo "<pre class='printr'><code>"; | |
print_r($arr); | |
echo "</code></pre>"; |
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
$str = preg_replace('/[^0-9.]+/', '', $str); |
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
# Colors | |
color_echo() { | |
# Parameters | |
local message=$1 | |
local color=${2-'default'} | |
local attribute=${3-'none'} | |
# Other vars | |
local color_type='3' | |
local color_code='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
/* | |
* Get paths to the js files to use in yepnope | |
* window.thePath is defined in footer | |
*/ | |
(function(yepnope) { | |
// Domain name | |
// var domain = window.location.host, | |
// origin = window.location.origin; |
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
/** | |
* Detect a browser | |
* http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie | |
*/ | |
var BrowserDetect = | |
{ | |
init: function () | |
{ | |
this.browser = this.searchString(this.dataBrowser) || "Other"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; |
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() { | |
/** | |
* Toggles a drawer panel | |
* | |
* Click a button and a drawer is shown, click elswhere and it's closed, | |
* open it when element inside the drawer is focused with a keyboard. | |
* | |
* @param {string} trigger ID, class, or element name to the button that toggles the drawer |
OlderNewer