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 ratingToInt = function( str ) { | |
// numstr = ' 18.6k ' | |
str = str.trim(); // "18.6k" | |
var number = parseFloat(str); // 18.6 | |
var letter = str.replace(/[^kmb]/g, '');//"k" | |
switch( letter ) { | |
case 'k': | |
number = number * 1000; |
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
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var ratingToInt=function(t){t=t.trim();var e=parseFloat(t),i=t.replace(/[^kmb]/g,"");switch(i){case"k":e=1e3*e;break;case"m":e=1e6*e}return parseInt(e)},ratingsGetValues=function(t){var e=t.children("li");if(e.length<3)return!1;var i={up:ratingToInt(e.eq(0).text()),down:ratingToInt(e.eq(1).text()),play:ratingToInt(e.eq(2).text())};return i.rating=(i.up-i.down)/i.up,i},updateList=function(){var t=jQuery("#search-results-list"),e=t.find("tr.mission-result-text");e.each(function(){var t=jQuery(this),i=t.find("ul.ratings");if(!(i.find("li.percent").length>0)){var a=ratingsGetValues |
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 | |
/* | |
Takes a term from many input types: object, id, slug, name | |
Returns one of many outputs: WP_Term (object), id (int), slug, name, or any WP_Term property | |
Example Inputs: | |
smart_term_convert( 390, 'category', 'id' ); // Returns 390 | |
smart_term_convert( 'test-category', 'category', 'id' ); // Returns 390 | |
smart_term_convert( 'Test Category', 'category', 'id' ); // Returns 390 |
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 | |
/** | |
* Example Usage | |
*/ | |
$url = 'http://example.org/'; | |
$vars = array( | |
'name' => 'Radley', | |
'awesome' => 1, | |
); |
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 | |
/* | |
YARPP Template: Image Previews | |
Description: Four columns of posts, each with a photo. | |
Author: radgh (RadleyGH@gmail.com) | |
*/ | |
// Put your placeholder image ID here, from the media tab in the dashboard, or leave it false to disable. | |
$placeholder_media_id = false; |
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
{ | |
"kind": "metapackage", | |
"abstract": "A list of modules installed on the default KSP instance", | |
"name": "installed-default", | |
"license": "unknown", | |
"version": "2015.10.23.04.07.26", | |
"identifier": "installed-default", | |
"spec_version": "v1.6", | |
"depends": [ | |
{ |
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 | |
// $src = wp_get_attachment_image_src( $attachment_id, 'store-archive' ); | |
// $src[0] = "http://.../uploads/my_image-240x350.jpg" | |
// $src[1] = 240 | |
// $src[2] = 350 | |
add_action( 'after_setup_theme', 'ld_theme_image_sizes' ); | |
function ld_theme_image_sizes() { | |
// archive pages |
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
-- Select the count of posts grouped by year, month, day, hour, even minutes and seconds! | |
SELECT | |
-- Number of posts on the specified time range | |
COUNT(*) as "count", | |
-- Time values to return | |
-- These should also be listed under "group by" | |
-- If sorting is necessary, also include these in "order by" | |
YEAR(p.post_date) as "year", | |
MONTH(p.post_date) as "month", |
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 | |
/* ---------------------------- | |
Parse a string with percent-signed wildcards, where the wildcards are PHP date characters. | |
Example: | |
$string = "Today is %F %j%S" | |
Returns: Today is January 1st | |
*/ | |
function parse_date($string, $date = false) { | |
if ( !$date ) $date = time(); |
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 | |
function change_wp_mail_sender( $phpmailer ) { | |
$from_name = 'My Website'; | |
$from_email = get_option('admin_email'); // The same email seen in Settings > General | |
if ( | |
// We should always have these parameters, but it doesn't hurt to avoid errors in the future | |
property_exists( $phpmailer, 'From' ) | |
&& property_exists( $phpmailer, 'FromName' ) |