Archive for August, 2010

Twitter will eat your URLs

Saturday, August 28th, 2010

My HTML periodic table has been getting a lot of attention on Twitter over the last few days. Because the page has a relatively short URL a lot of people have been tweeting the actual URL rather that using a URL shortening service. This has been good for me because shorteners remove the HTTP referrer and stop me from seeing where my Twitter traffic comes from.

A peek at my error logs did reveal one potential problem though. I’ve had well over a thousand hits to invalid URLs like http://joshduck.com/perio. These are obviously URLs which have run up against Twitter’s infamous 140 character limit and have been truncated. This results in wasted traffic for me and a waste of time for my visitors so I decided to push a quick fix. (more…)

A PHP snippet for pluralizing strings

Friday, August 13th, 2010

Every time I’m working on CRUD applications it seems like a lot of boilerplate code goes towards displaying appropriate messages when lists can contain zero, one or more than one element. I put together a quick function to speed up the process.

The function takes a string with string fragments marked up inline as its main argument. It then formats the output based on the count passed into the function. (more…)