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
/** | |
* Works in Chrome, Firefox, MSIE, Opera and Safari. | |
*/ | |
function onDOMContentLoaded( event ) { | |
if( event ) { | |
document.removeEventListener( event.type, onDOMContentLoaded, false ); | |
} | |
document.onreadystatechange = null; | |
// For testing purposes. | |
alert( "DOM Content Loaded" ); |
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
/** | |
* A class-based approach to bring in Facbook Connect asynchronously on every | |
* frontend page load. Also handles side-loading channelURL when using | |
* Facebook's FB.init() method. | |
* | |
* This fits nicely in any functions.php, or can be dropped in to a standalone | |
* php file to use as a plugin. | |
* | |
* @link http://developers.facebook.com/docs/reference/javascript/FB.init/ | |
*/ |
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 | |
/* | |
A quick set of functions to move items in a non-associative array | |
up or down by one, shifting the items around it appropriately. | |
Original usage was to for a set of UP and DOWN buttons to | |
manipulate the order of an array of items stored in Wordpress option. | |
*/ | |
$a = array('a','b','c','d','e'); |
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
/* | |
An example of using MySQL's ENCRYPT() and DECRYPT() functions to store | |
sensitive data in a Wordpress Option. In this case, a password. | |
This only provides a bare amount of security as your Key is likely stored somewhere | |
else in your code or database. Basically, its not plaintext. | |
http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html | |
*/ |
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
#!/bin/bash | |
# http://www.ivorde.ro/How_to_backup_all_mysql_databases_with_one_command-51.html | |
# http://bash.cyberciti.biz/backup/backup-mysql-database-server-2/ | |
# http://sgowtham.net/blog/2008/04/04/backing-up-and-restoring-mysql-databases/ | |
# Requires: http://s3tools.org/s3cmd | |
MyUSER="YOUR-USERNAME" | |
MyPASS="YOUR-PASSWORD" | |
MyHOST="localhost" |
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
/* When an html page like URL is accessed, return some static content, | |
In this case, a verification page for Google Apps | |
In the current theme functions.php: | |
*/ | |
if( !class_exists('google_verify') ) { | |
class google_verify { | |
public function __construct() { | |
add_filter('rewrite_rules_array', array($this,'gv_rewrite') ); | |
if( !is_admin() ) { |
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
// Adapted from jQuery TimeAgo plugin: | |
// https://github.com/rmm5t/jquery-timeago/blob/master/jquery.timeago.js | |
// Update, check out performance: http://jsperf.com/twitter-relative-time-parsing | |
function timetowords(timestamp) { | |
var words = { | |
"seconds": "less than a minute", | |
"minute": "about a minute", | |
"minutes": "%d minutes", |
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
jQuery(document).ready(function($) { | |
$.getJSON('http://twitter.com/statuses/user_timeline/Shitmydadsays.json?count=4&callback=?', function(data){ | |
var relative_time = function(datetime) { | |
var delta = parseInt((Date.now() - Date.parse(datetime)) / 1000, 10); | |
var r = ''; | |
if (delta < 60) { | |
r = delta + ' seconds ago'; | |
} else if (delta < 120) { | |
r = 'A minute ago'; | |
} else if (delta < (45 * 60)) { |
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
/* | |
This will work on WP 2.7.0 on up on the commonly used get_xxxxxxx_posts_link call. | |
From Google: | |
http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html | |
*/ | |
add_filter('next_posts_link_attributes', create_function('$attr','return $attr.\' rel="next" \';')); | |
add_filter('previous_posts_link_attributes', create_function('$attr','return $attr.\' rel="prev" \';') ); |
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
/* | |
For use in functions.php in combination with: | |
http://wordpress.org/extend/plugins/google-analytics-for-wordpress/ | |
*/ | |
add_filter('wp_nav_menu', 'menu_ga_tracking', 99); | |
function menu_ga_tracking($menu) { | |
if( class_exists('GA_Filter') and yoast_ga_do_tracking() ) { | |
$menu = preg_replace_callback( |
OlderNewer