Web Notifications Safari 6.0 and OSX 10.8

Web notifications have been around for a while, but with Apple’s latest release of OSX 10.8 and notification center they are most likely to become a bit more popular. I had a look into the developer documentation for safari and found a nice chunk of code for displaying notifications in Safari 6.0.

Safari 6.0 Notifications
Continue reading →

tar and gzip files from linux command line

Sometimes it’s hard to rememeber all the options you need to include to tar and gzip files or a folder from the command line. Here it is…

tar -cvzf tarballname.tar.gz myfilestocompress

To untar and unzip simply do:

tar xvfz filename.tar.gz

And if there are only certain files you want in the tar then do:

tar xvzf filename.tar.gz */dir.you.want/*

MIME Media Types

A useful reference for different MIME types:

IANA | MIME Media Types.

Installing SSH2 Extension for PHP on CentOS 5

Here is a great tutorial from Dynamic Hosting Blog on installing ssh2 extension for php. I use this often for wordpress installations since I don’t normally setup my server with ftp. This will allow me to download and install updates/plugins using ssh instead of using the less secure ftp.

via Installing SSH2 Extension for PHP on CentOS 5 | Dynamic Hosting Blog.

Show Categories Filter on Custom Post Type List

Found this useful thread on displaying a category filter on a custom post type in wordpress. Here’s the code:

add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' );
function my_restrict_manage_posts() {
	global $typenow;
	$taxonomy = 'your_custom_taxonomy_name';
	if( $typenow != "page" && $typenow != "post" ){
		$filters = array($taxonomy);
		foreach ($filters as $tax_slug) {
			$tax_obj = get_taxonomy($tax_slug);
			$tax_name = $tax_obj->labels->name;
			$terms = get_terms($tax_slug);
			echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
			echo "<option value=''>Show All $tax_name</option>";
			foreach ($terms as $term) { echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>'; }
			echo "</select>";
		}
	}
}

WordPress › Support » Show Categories Filter on Custom Post Type List.

Using term_description as keyword meta

I found a good use for WordPress’s taxonomy description. I’m using it to display keywords for the meta tag. When a user visits the archive page of a taxonomy the keyword meta will be displayed in the header.

Put the following code in your header file. Then make sure to put in a comma separated list of keywords in the description field of your custom taxonomy or category.

$desc = term_description( '', get_query_var( 'taxonomy' ) );
 
if($desc != ''){
 
	echo '<meta name="keywords" content="'.strip_tags($desc).'" />';
 
}

via Function Reference/term description « WordPress Codex.

Upload issues on WordPress with Mediatemple DV server

I was having some trouble a while back uploading media to my WordPress install. I would continually get an error stating that the media couldn’t be moved to the correct folder. I had tried all the forum solutions including even changing permissions to 777. Nothing seemed to work. After stumbling across a few threads on wordpress and finding a Mediatemple community wiki article I came up with a solution. Continue reading →

Nginx and Weird “400 Bad Request” Responses | Life Scaling

I noticed the other day that Google Chrome was giving me a 400 bad request when I tried to visit one of my web sites. My server is built on linode using nginx as a front end and apache as the back. No other browsers were giving me this problem. I cleared the cache and this fixed the problem, but I had a sneeking suspicion that it would happen again. Oren Solomianik of Life Scaling came up with a solution that seems to do the trick. See the link below.

trackback uri

via Nginx and Weird “400 Bad Request” Responses | Life Scaling.

Producteev PHP Library

Our organisation started using Producteev a while back for task management. It’s a pretty decent platform and has a nice api. Angelo R. from http://xangelo.ca has done some work to create a PHP Library for the api. It works well but I noticed that any time you added a space to value that you where sending to Producteev the code broke. I found the problem and have created a new library with the added fix:

Download Producteev PHP Library

chrome.extension.sendRequest won’t pass object

Recently I had a bit of trouble with Google’s chrome.extension.sendRequest function used in their Chrome extensions API. I found that I was not able to pass my variable outside of the function. I came accross this post that helped explain the reason why. Continue reading →