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
/*************************************************** | |
* Takes a jQuery element $elem and animates the inner HTML if it is a number. | |
* Counts up to 'final_num' from 'start_num' over 'duration' milliseconds. | |
***************************************************/ | |
animateSingleNumber : function($elem, final_num, start_num, duration) { | |
var original_num = $elem.html(); | |
// If not set, take inner HTML of elem | |
if (!final_num) final_num = parseFloat($elem.html().replace(/,/,'')); |
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 | |
/** | |
* Retrieves a template part and caches the output to speed up site | |
* NOTE: Because we are caching display of posts, we need to make sure to delete the transients when posts are updated or published that might affect these template parts. | |
* | |
* Uses this function in conjunction with the WP cache: http://codex.wordpress.org/Function_Reference/get_template_part | |
* | |
* @param $slug (string) (required) The slug name for the generic template. | |
* @param $name (string) (optional) The name of the specialized template. | |
* @return (string) HTML output of the template part. |
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 | |
/** | |
* Sort a multi-domensional array of objects by key value | |
* Usage: usort($array, arrSortObjsByKey('VALUE_TO_SORT_BY')); | |
* Expects an array of objects. | |
* | |
* @param String $key The name of the parameter to sort by | |
* @param String $order the sort order | |
* @return A function to compare using usort | |
*/ |
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 | |
/** | |
* Shorten large numbers into abbreviations (i.e. 1,500 = 1.5k) | |
* | |
* @param int $number Number to shorten | |
* @return String A number with a symbol | |
*/ | |
function numberAbbreviation($number) { | |
$abbrevs = array(12 => "T", 9 => "B", 6 => "M", 3 => "K", 0 => ""); |
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 | |
/*************************************************** | |
* This function takes in a float and returns a float that has been incrased based on the number of days elapsed since creation | |
* The purpose is to boost a number that is newer and slowly decrease that boost until it is no longer applied after the active period has ended. | |
***************************************************/ | |
// Number of days the boost is active - Bounded by 0 and the | |
// beginning of the sauce degradation phase. | |
define(ACTIVE_PERIOD, (float) 5); |
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
/*************************************************** | |
* Character Limit Counter displays an indicator below a text field telling the user how many characters they have left. | |
* | |
* INSTRUCTIONS: | |
* Add the attribute maxlength="XX" to your text input. | |
* Add the class "characterLimitCounter" to your text input. | |
***************************************************/ | |
var characterLimitCounter = { | |
initialize : function() { |
NewerOlder