Contagion

I just finished watching the movie Contagion. While slow, it was still fairly good and more about the characters than the contagion itself.

I suddenly have an urge to bathe in hand sanitizer though…

Saints Row: The Third

I had never heard of either of the previous two Saints Row games but I’m very glad I decided to take a look at the third title in the series. It’s similar to the Grand Theft Auto series but with the insanity turned up to 11. An incredibly fun game and worth checking out if you haven’t already! :)

EDIT: Still not convinced? Watch Simon and Lewis of Yogscast play through the first part of the game:

How To Remove (Or Change) “Private” Or “Protected” From WordPress Post Titles

If you make a post private in WordPress, the post’s title with be prefixed with “Private”. The same will happen if you password protect the post, although it will be prefixed with “Protected”. If you’d like to remove these, just add the following code to your theme’s functions.php file:

add_filter( 'private_title_format', 'yourprefix_private_title_format' );
add_filter( 'protected_title_format', 'yourprefix_private_title_format' );

function yourprefix_private_title_format( $format ) {
	return '%s';
}

The above code will remove the prefix by changing the format from Private: %s and Protected: %s to just %s where %s is the existing post title.

If you’d like to change it to something else, you can just change what the function in my example returns. If you want to change them independently of each other, then you’ll need to use two separate callback functions.

An Update On That Halloween Light Show House

Remember those videos I posted back on Halloween of a house featuring an amazing light show? Well after that LMFAO video went totally viral, LMFAO actually showed up at his house to do a video:

LMFAO even made use of his house for the American Music Awards:

He also created a great light show for “Sexy And I Know It”:

Props Matt whose post reminded me to post an update.

Yesterday I Learned

Yesterday I learned that when my 2001 Ford Mustang is running, the key fob is disabled and will not let you lock or more importantly unlock the car doors. I started up the car in order to warm up the cabin, took the key fob off my keyring, and then locked the door behind me. I was only going to be a few car lengths away from it but I didn’t want anyone hopping in it and stealing it. This turned out to be a huge mistake. One call to AAA and 45 minutes of car idling later, they showed up to jimmy a door open for me so I could turn it off. :(

Interestingly my dad’s Ford Explorer, which is only a few years newer than my car and shares many common Ford parts, doesn’t do the same thing. It’s key fob works perfectly fine with the engine running. Hmm.

How To Create Custom WordPress Cron Intervals

This is mostly a reminder for myself so I can stop tracking it down every time I forget, but here’s how to have WordPress code execute on a different schedule than the default intervals of hourly, twicedaily, and daily. This specific example is for weekly execution.

<?php

// Add a new interval of a week
// See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
add_filter( 'cron_schedules', 'myprefix_add_weekly_cron_schedule' );
function myprefix_add_weekly_cron_schedule( $schedules ) {
	$schedules['weekly'] = array(
		'interval' => 604800, // 1 week in seconds
		'display'  => __( 'Once Weekly' ),
	);

	return $schedules;
}

// Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'myprefix_my_cron_action' ) ) {
	wp_schedule_event( time(), 'weekly', 'myprefix_my_cron_action' );
}

// Hook into that action that'll fire weekly
add_action( 'myprefix_my_cron_action', 'myprefix_function_to_run' );
function myprefix_function_to_run() {
	// Add some code here
}

?>

On a side note, I believe this must go in a plugin and not your theme’s functions.php which I hear loads too late.

Help Me Name My Latest Plugin

I’m having trouble coming up with a good name for my latest WordPress plugin so I thought I’d crowd source it. :)

My other WordPress-powered site, FinalGear.com, receives very large traffic spikes. I used to just run WP Super Cache to prevent the site from going down but Apache would still actually die under the load even though it was just serving static content. Since the site has no comments or other often changing content, the easiest solution at the time was just to throw a reverse proxy called Varnish in front it with a decent cache time (5-10 minutes per page). I’ve since switched from Apache to nginx which solves that issue but it’s still easiest to just leave Varnish there.

Varnish is set up to ignore cookies on the front end of the site. That means I get served the exact same version of the site that you (a guest) sees — no admin bar, no post edit links, and so forth. Getting to the admin area is easy thanks to an absolutely positioned hidden link in the bottom left of the site (hover over it, you’ll find it) so lack of an admin bar is no problem for me.

What is a problem though is the lack of easy way to edit a post. I currently have to go into the admin area and then browse to the post in order to edit it. So I wrote a plugin that outputs the edit post link even for people who aren’t logged in. However the link is hidden using CSS and then re-shown using Javascript only if you have a logged in cookie.

It works perfect but what to call it? My working title was “Javascript Edit Links” but that seems so bland and locks me a bit into a corner. What if I someday want to add other features to the plugin, such as even showing the full admin bar? Do you have any better ideas?