Category Archives: Coding

JSONView: View JSON Data in Firefox

JSON is a popular way to format AJAX responses, as it’s more compact than XML and essentially a JavaScript object, but it can be a real pain to work with due to uncooperative browsers. It’s easy enough to view XML in a web browser, which is good for testing, but JSON responses cause a download prompt to open. This makes it harder to verify that an AJAX request is working properly.

Fortunately, a clever developer has built a Firefox extension to solve this problem. JSONView renders a plain-text representation of the JSON object, complete with indentation and color-coding whenever you access a URL that outputs JSON data. For example, the Twitter API. If you click this link in Firefox, you will be prompted to download the file. With JSONView installed, you would see output from the following image.

If you do much JavaScript work, be sure to install JSONView. It will save you some headaches when you have AJAX requests that aren’t working quite right.

An Explosion of Instant Search Sites

Since Google rolled out Google Instant, there has been an explosion of search mashups created by enterprising developers. First there was YouTube Instant, for which the creator was offered a job at Google. Next came iTunes Instant, which lets you quickly search the iTunes…

Parsing Lua Scripts With PHP

Lua is a lightweight scripting language designed to be embedded in larger programs in order to allow for user customization. The most popular application to include a Lua interpreter is probably World of Warcraft. The entire user interface is customizable through Lua scripting, and…

Building iTunes Links

Have you ever wanted to link to an iTunes page? It’s easy enough to copy a long, nasty-looking URL like http://itunes.apple.com/us/album/yours-truly/id310905907 right from the application by right-clicking on the album art or title. This works well enough if you’re manually linking to an album…

Authenticating Users With Twitter OAuth

If you’ve ever played around with the Twitter API, you’ll know that many functions require authentication with either a username/password combination or OAuth. Soon Twitter will be turning off basic authentication for security reasons, in favor of the more complex OAuth protocol. There are…

MediaElement.js — HTML5 Video Player With Flash Backup

Many modern web browsers have early support for the <video> and <audio> elements in the HTML5 spec. Unfortunately, their implementation varies depending on the ideals of the various browser developers. Safari expects video to be encoded in the high-quality H.264 codec, other browsers prefer…

Calculating Relative Time Stamps With PHP and WordPress

If you go to a social networking site like Twitter, you’ll note that status updates don’t have conventional timestamps on them. Instead of something overly informative (in most cases) like “Posted 2010/07/06 7:50 PM” they tend to show the much more human-friendly “Posted 2…

CSS Selector Efficiency

Here’s a fun (and slightly puzzling) fact: CSS selectors are parsed from right-to-left instead of from left-to-right when the browser renders a page. This means that when you have a selector like .navigation a { color: red; }, the browser first searches for a…

Loading JavaScript Asynchronously

BuySellAds and Google Analytics, in an attempt to make the internet faster, recently changed the code snippets they use for serving ads and tracking visitors, respectively, to be non-blocking and asynchronous. This means that the scripts won’t hold up the rendering of your pages…

PHP Simple HTML DOM Parser

It’s always fun to obtain data from REST APIs and parse the XML or JSON response. Twitter, for sure, wouldn’t be what it is today if not for the thriving community of developers building applications that tie-in with the API. But what do you…