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 | |
$mycontent = $post->post_content; // wordpress users only | |
$word = str_word_count(strip_tags($mycontent)); | |
$readingRate = 200; | |
$m = floor($word / readingRate); | |
$s = floor($word % readingRate / (readingRate / 60)); | |
$est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's'); | |
?> | |
<p>Estimated reading time: <?php echo $est; ?></p> |
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
/* ======================================================================== | |
* DOM-based Routing | |
* Based on http://goo.gl/EUTi53 by Paul Irish | |
* | |
* Only fires on body classes that match. If a body class contains a dash, | |
* replace the dash with an underscore when adding it to the object below. | |
* | |
* .noConflict() | |
* The routing is enclosed within an anonymous function so that you can | |
* always reference jQuery with $, even when in .noConflict() mode. |
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
//https://www.debuggex.com/r/H3Wz2nlxZUJcs7sV/3 | |
/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-??(?!5{3})[2-9]\d{2}-?\d{4}$/ |
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
(function($, window) { | |
var self = $('html'), | |
dragDelta = 500; | |
friction = 0.35; | |
mouseDown = false, | |
touchDelta = 0; | |
startSwipe = 0, | |
isDragging = false; | |
//Assume no touch on load |
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
// Updated: 01/28/2014 | |
// Changes: | |
// Removed all non animation specific code | |
// Updated to allow passing in of positioning | |
var cssAnimation = (function($) { | |
var speed = 250, | |
easing = 'linear', | |
cssTransition = 'cubic-bezier(0.39, 0.575, 0.565, 1)', | |
done = false, |
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
function custom_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt ) { | |
//Always return an image with a <figure> tag, regardless of link or caption | |
//Grab the image tag | |
$image_tag = get_image_tag($id, '', $title, 'None', $size); | |
//Let's see if this contains a link | |
$linkptrn = "/<a[^>]*>/"; | |
$found = preg_match($linkptrn, $html, $a_elem); |
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
(function($) { | |
$(document).ready(function() { | |
$('body').on('mousedown', '#wp_delimgbtn', function(e) { | |
var editor = tinyMCE.activeEditor, | |
element = editor.selection.getNode(); | |
if(element.tagName !== 'FIGURE') { | |
$(element).parents('figure').remove(); | |
} | |
}); |
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
/** | |
* Throttled Resize event | |
* Updated to use requestAnimationFrame instead of setTimeout | |
* Original: https://github.com/louisremi/jquery-smartresize | |
*/ | |
var $specialThrottle, | |
dummy = {_:0}, | |
frame = 0, | |
wasResized, |
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
/** | |
* Adds DoubleClick or SiteCatalyst to any element using supplied | |
* selectors. If no selectors are given, function defaults to | |
* data-dctracking and data-tracking. | |
* | |
* @param {string or array} selectors elements to set tracking | |
*/ | |
function setupTracking(selectors) { | |
//Can pass in selectors as string or 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
var prefix = (function () { | |
var styles = window.getComputedStyle(document.documentElement, ''), | |
pre = (Array.prototype.slice | |
.call(styles) | |
.join('') | |
.match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']) | |
)[1], | |
dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1]; | |
return { | |
dom: dom, |
NewerOlder