PHP — No comments
04
Jan 10
Sometimes, you want to round a number, but you want the nearest half instead of a full number. For example, if you have an average rating, and you want to display a star graphic representing the number of stars. In the interest of simplicity, you would like to show only full or half stars (3.5 stars instead of 3.43 stars). Here is a very simple example of how to do this in php.
<?php
$average = 3.43;
$round_to = 0.5; // you can change this to any increment you like
$rounded = round($average / $round_to) * $round_to;
The variable “$rounded” is now set to 3.5.
Tools — No comments
29
Sep 09
Pngcrush is a command line tool that processes png files through several algorithms (read “magics”), optimizing the png without quality loss. Here is how you can install it from source on snow leopard. Continue reading →
Web — No comments
25
Sep 09
Google announced that they have added a new feature to search results. The brief summary in a result may contain links to specific sections of content on the page. This helps get a user directly to the most relevant content faster. For example, if I search for “jquery tabs”, one of my results looks like this:

Clicking “How To…” would take me directly to this portion of the page (http://docs.jquery.com/UI/Tabs#How_to…) instead of the top of the page (http://docs.jquery.com/UI/Tabs). I think that I will enjoy this feature quite a bit, and since most users do not scroll, this should get some dusty content a little bit of fresh attention. Continue reading →
CSS — No comments
21
Sep 09
A project I worked on recently called for a carousel with five images of different sizes — somewhat like a “light” coverflow. I ended up building it with basic <img> tags that get scaled by javascript which modified the width attribute.

Cover Slider Layout
One of the problems that I ran in to involved the loss of quality from Internet Explorer 6 and 7 when the browser renders the image at a smaller dimension than the file.

An image scaled in internet explorer.
This project was for a site that still has a substantial amount of visitors using IE6 (and IE7’s scaling abilities are not much better than 6). So I needed to come up with a way to correct the image scaling. A short google later, I found Ethan Marcotte’s blog post Fluid Images [via Unstoppable Robot Ninja] and a post on flickr’s developer blog. Continue reading →
Misc — No comments
29
Jul 09
Sometimes you want to search for something, but only within a specific set of sites. For example, Smashing Magazine recently posted a list of 45+ Excellent Code Snippet Resources and Repositories. Occasionally, I find myself opening several tabs to search through a few of my favorite sites from this list in hopes that someone else has already figured out the best way to do something; so I decided to make a custom search engine.
Google provides an easy to use tool for building a “customized search engine” that only searches the sites you specify. Google Custom Search may not receive a lot of hype around the internet, but it is a very simple, yet powerful resource. Continue reading →
Javascript — No comments
13
Jul 09
David Walsh recently posted a solid list of 7 MooTools Plugins You Should Use on Every Website. Many of his posts use jQuery, but since this one focused on MooTools, I thought I would put up a list of some jQuery plugins that perform similar tasks. This is not a jQuery vs MooTools post — just a list for sites that already use jQuery. Continue reading →
Tools — No comments
12
Feb 09
Selenium is a set of tools for web based unit testing. With a full implementation it has many advanced features, but the smaller and lighter IDE runs inside firefox. Using this arm of the suite by itself can serve as a convenient tool during actual development. Continue reading →