Filter documents in WordPress media library

The WordPress media library has a few nice features for managing uploaded files. One thing it doesn't do is make it easy to find documents. It makes it easy to filter all the files to list only the images, or video, or even audio files, but not documents like PDFs, Word documents, spreadsheets etc. But adding a Documents link to the media library is just a few lines of code away.

Telling CSS3PIE about dynamic elements

I love CSS3PIE. I love that I can make use of some of the CSS3 niceties like rounded corners and box shadow, and even IE7 and IE8 can keep up with the more modern browsers and not look too shabby. But if you're adding or moving elements around on your page dynamically, e.g. changing something from display:block to display:none and back, sometimes PIE can't keep up and leaves a box shadow in a strange place.

Simple URL cleanser in PHP

There are lots of ways to tidy up a URL to remove "special" characters. Some do more than others, some purport to do a lot but really don't do much. Some, like WordPress' sanitize_title_with_dashes, throw six or more regular expressions and a couple of multi-byte string conversions at your string but don't handle accented characters. Here's a simple one that does convert accented characters.

Minify CSS on the fly

Keeping your website content as small as it can be so that it downloads fast is as important today as it was back in the pre-broadband days, given that you don't know whether your visitors will be accessing your websites via broadband, dialup, or mobile connections. As CSS files grow, it can be as important to minify them to trim the fat as it is for JavaScript downloads. Here's how I do it on-the-fly for CSS.

Autocomplete in WordPress plugin admin

I just had to find a way to add autocomplete to an admin screen for a WordPress plugin I'm writing. Although a few pieces of jQuery UI are bundled into the WordPress distribution, that doesn't include jQuery UI autocomplete. But on the way to investigating how to drop that into my plugin, I discovered that WordPress does bundle in a similar, simpler plugin called jquery.suggest.

CSS3 linear gradients and Internet Explorer

CSS3 has been tempting me with linear gradients for a while now. They don't work in Internet Explorer, but there are ways and means with a little script magic. Now that Opera has finally joined the party, I figured it was time to ditch those ever pervasive linear gradient background images and start using CSS3 for linear gradients. But it's not all rosy, especially when you need to position your background.

Internet Explorer CSS hacks with JavaScript

Sometimes it's just easier to write a quick hack to get the job done. This is one of those times. SWMBO, the CSS guru in the house, quite rightly wants to use the :before and :after pseudo-elements to add some style to a website, in a way that will make it easy for the client to add content without struggling with keeping the format consistent. That's easy enough in Firefox, Safari, Chrome, Opera, even Internet Explorer 8 and 9... but not Internet Explorer 6 or 7.

Calling JavaScript from VBScript

I've been working on a Classic ASP / VBScript website recently, so I have been brushing up against the limitations of VBScript again. Not hard limitations, like "you can't do that", just inconveniences like... no sort for you! Rather than dust off my old copy of a sort algorithm, I figured the easiest way, and the path to best performance, would be to just...

Keeping Classic ASP Alive

Initially released with Microsoft Internet Information Services (IIS) late last century, Classic ASP hasn't seen an update to its functionality since ASP 3.0 in 2000. Used on website and web applications typically written in VBScript, Classic ASP somehow seems to keep on going even in the face of competition from better, more modern website development platforms like ASP.NET, PHP, Java Servlets and JSP, Ruby on Rails, ... the list goes on. In many cases it can be harder to achieve something in ASP than in a more modern development platform.

First post

Yes, yet another programmer’s blog about programming. The intention is to provide somewhere for me to keep a record of some nifty tricks I’ve picked…