Free Scripts

Here you will find a collection of code I have written and, for whatever reason, have decided to donate to the world. Enjoy! The most recently updated scripts are at top.

  • New Lines to Paragraphs
    By far the most popular code in the site, and has been widely adapted in different projects. Basically it takes PHP’s nl2br function to the logical next step and converts double line breaks to paragraphs where applicable, does line breaks as before, and best of all it’s aware of block-level HTML tags so it won’t mess up your page.
  • Intelligent Menus
    Using some very simple PHP and CSS you can create intelligent menus that are easy to use and maintain.
  • Random Image Script
    This is your standard random image script that takes a slightly different approach than most, namely using standard HTTP headers instead of reading the file through the script.
  • Cardinal Endings for Numbers
    Adds cardinal endings to numbers, like 1st and 2nd, and doesn’t do much else. Has an option or two that might make this useful for you.

Really old stuff

I have no idea who would want this anymore, but it’s left up for historical purposes.

  • Fancy Blogrolling
    This is a bit of code that will grab your link list and parse it to display as a semantically correct list and then cache the results for whatever amount of time that you specify.
  • PHP Acronym Definer
    When you run your text through this code it will define all the acronyms it can using the acronym tag. It also has a few other niceities, so check it out.
  • Curly Quotes Function in PHP
    The predecessor to the Texturize function. Soon to be totally depreciated. Has some neat regular expressions if you want to check it out though.
  • Nice URLs for b2
    A combination of mod_rewrite and some template code changes allow you to generate much nicer URLs with the b2/cafelog blogging system. A lot of people have found this useful as an introduction to mod_rewrite.
  • Curly Quotes for Movable Type
    Implementation of the curly quotes function in Perl using Brad Choate’s regex plugin. As far as I know this was the first code of its type for Movable Type, though now there are some better alternatives for that system such as Smarty Pants and Textile. If there’s interest I’ll look into porting Texturize to Perl since it does a bit typographically than either of those systems.