Title Case for Movable Type

John Gruber shared a code snippet that converts strings to Title Case. It’s actually more clever than it sounds, taking into account the need to keep a collection of small words uncapitalised, and correctly handling punctuation issues.

Here’s a version for Movable Type that can be used to automatically convert entry titles to title case. It is essentially a wrapper for John’s script that adds some functionality to deal with html entities (so it should play nice with Smarty Pants and Widon’t).

Download

Title Case for Movable Type v1.1 (2008-05-23)

Installation

Unzip the file and place TitleCase.pl in the plugins directory of your Movable Type installation.

(mthome)/plugins/TitleCase.pl

Usage

For titles, add the global filter titlecase="1" to your entry title tags:

<mt:EntryTitle titlecase="1"/>

TextMate Tip for CSS — Single Line Overview

CSS files need to be formatted so they are readable at two levels: the broad level of scanning the document selectors, and the finer level of locating individual property rules within selector blocks.

I’ve tried several ways of formatting my CSS to balance these two views, without much success. I’ve tried indenting rules based on their place in the document hierarchy, or making heavy use of summary comments to facilitate searching, broken groups of selectors over several cumbersome files and used single line selector blocks. None of these techniques helped tame unruly CSS files once they exceed a few hundred lines.

That last technique though, of using single line selector blocks, does help with the broad level view, but renders the property rule level unreadable. I still want each property on its own line. How do I achieve both views?

Code folding in TextMate

TextMate for OS X (and probably other quality text editors on other platforms) has the ability to fold blocks of code, collapsing each block except for their first lines. Doing this to a CSS file (Alt+Cmd+0) leaves just the document selectors on single lines, temporarily hiding their property rules. This is perfect for scanning through a large file to locate a specific selector. When it’s time to focus on the finer level of detail, the block can be revealed by toggling the selected block (F1 or clicking the arrow in the gutter). When you’re finished, toggle it back up again. As there is only one or two blocks unfolded at a time, it’s very easy to focus on the code without getting lost.

del.ija.vu — Already Bookmarked

While chatting with a friend on IM, we came up with a term to describe what happens when you bookmark a page, only to find that you’ve already bookmarked it sometime previously: del.ija.vu. If you find yourself in this situation, add “del.ija.vu” to the tags for that page. We can’t be the only people this happens to!