A Complete List of Code I Didn’t Write
by Cosmo Catalano
I recently updated my official online presence, and rather than toss attribution about willy-nilly, I figured I’d make a blog post to acknowledge the few bits of code that I didn’t write from scratch.
Of course, “from scratch” can be a slippery term as far as websites go, so I drew the line at any code on, or that helps generate, the index page at CosmoCatalano.com that isn’t 1) a documented library function in a default installation of an established programming language, or 2) that I didn’t write from a blank file in a text editor.
- jQuery Tabs. Tabs are easy to make in jQuery, but I tackled this part of my site early, and didn’t want to bog down reinventing the wheel. In hindsight, I should have, as this particular tab implementation hides all
<div>elements by default, meaning that all my tabbed content is in
<span>, set to
display:block. It’s easy to read and no modern browser will gag on it, but it’s also semantically incorrect. Probably something I’ll re-cook a few months down the line.
- XML String to Array. It’s not especially hard or uncommon to go from an XML string to an array in PHP. But it can be surprisingly time-consuming and frustrating. This function makes parsing the RSS feeds my site uses much quicker, though it does occasionally freak out on things like KML.
- Regex for Clickable Twitter Links/Usernames/Hashtags. I have a love/hate relationship with regular expressions. They can be as frustrating as they are powerful, and I’ll do some solid Googling for an existing regex I can adapt before starting out on my own. Better programmers than I have been using regular expressions for a long time, and it’s hubris to think most problems I want to tackle haven’t already been better solved by someone else.
- jqModal. This jQuery plugin powers the “modal window” that displays the full-size version of my Instagram pics. It’s important to note that setting up these plugins isn’t copy-and-paste affair. New code has to be created to hook them onto the right parts of a given website, and getting everything to run right can be a detail-oriented proposition.
- Lazy Load. Another jQuery plugin. The 8 full-size Instagram images can take a while to load on slow connections, so instead, I fill the modal windows with an appropriately branded, 8kb place-holder, and use Lazy Load to trigger loading the big images a second after the rest of the page completes.