Weekly link dump


On the off chance you haven’t come across this, Soma is the best site for streaming electronic music out there. They also have some fun novelty stuff, and do great Christmas streams.

The secret to making great coffee revealed

A Slate article on the pour-over coffee-brewing method. Londoners, this is how Monmouth makes their filter coffee.

How to Use If-Then Planning to Achieve Any Goal

Planning your activities based on a trigger and a response. This is very similar to how the author of “The Power of Habits” describes the process by which habits are strengthened.

Add a class to the first and last items of a WordPress menu

If you’re using the WordPress dynamic menus, you can use the following code to add first-menu-item and last-menu-item to the appropriate menu items.

Add the following to your theme’s functions.php:

function add_first_and_last($output) {
    $output = preg_replace('/class="menu-item/', 'class="first-menu-item menu-item', $output, 1);
    $output = substr_replace($output, 'class="last-menu-item menu-item', strripos($output, 'class="menu-item'), strlen('class="menu-item'));
    return $output;
add_filter('wp_nav_menu', 'add_first_and_last');

Via Kuroi at the WordPress.org forums.