Cover Image

Parsing URLs in JavaScript

There's an excellent trick to parsing URLs in JavaScript, which was introduced last year by John Long over on GitHub. This technique works great, but the resulting search property will be a raw query string. This isn't very useful if you need to access certain variables in said query string. Thus, the following function expands on this paradigm, providing an additional property that contains an object based on the original query string.

Cover Image

Office 2007 Files Downloading as ZIP Files in Internet Explorer

Today I learned that Microsoft Office 2007 files (you know, the new ones that end in DOCX, XLSX, and PPTX) don't always download properly in Internet Explorer. In fact, IE tends to see them as ZIP files and forces their extension to change to .zip when you select download. This is because IE is checking for the MIME type instead of blindly going by file extensions. Ironically, since it doesn't recognize the new Office 2007 files for what they are, IE renames their extensions to .zip upon downloading.

Cover Image

Calculating Age with PHP

You would think that determining a person's age would be a very simple task for a PHP developer.  However, when I asked this question for myself I found a variety of solutions that people posted online.  Many of them used large functions with conditionals and other logic that was hard to follow.  After a significant amount of research, I've come to find the shortest and most accurate solution to this question.

Cover Image

Convert Word (and other) Documents to PDF for the Web

As a developer in the content management industry, I see people uploading Word documents and other proprietary formats to the web all the time. This is especially true with smaller, homegrown websites that make brochures, newsletters, and forms that they want visitors to print out. The problem is that these formats aren't very web-friendly — and they're also very tacky.

Cover Image

$.postJSON() for jQuery

$.getJSON() is pretty handy for sending an AJAX request and getting back JSON data as a response. Alas, the jQuery documentation lacks a sister function that should be named $.postJSON(). Why not just use $.getJSON() and be done with it? Well, perhaps you want to send a large amount of data or, in my case, IE7 just doesn't want to work properly with a GET request.