Code, Code, Code (and a birthday)

Happy birthday to David Fried, aka Replicant Kitty, who turns 25 today. w00t!

In other news, I’ve added some code pages recently, the most fun one being the new code download folder. Using a little mod_rewrite and mod_autoindex magic, and 2 super-simple php scripts, I have a nicely working code repository. You can read more about it at /plugins/i-made/code-display-script.

However, I found that this meant that I’d have to have 2 copies if I wanted to use the code viewer plugin, or else the output from the plugin would be showing the source of the stylized output, resulting in an ugly mess.

I decided that that shouldn’t stop me, and that having two copies of the exact same file in this day and age is just stupid. I told the codeviewer plugin to look in the /code/ folder. Then, added some htaccess rules to make “/code/whatever” get translated into “/download/save.php?file=whatever&textonly=1″. The cool thing is that /code doesn’t exist - it’s just a pseudonym for my download folder, and tells it to process things in a specific non-stylized way.

Future Todos for that folder:

  1. Make it easier to add new files and attach a description to the .htaccess file. Of course, the humble zen simplicity of a flat file really is somewhat refreshing in this data-driven age. If I can think of something easier, I’ll implement it, but I haven’t at this point.
  2. Don’t assume that the file is “.txt” or “.php”. How about JavaScript or HTML files? Perhaps I should make the script sniff the contents to figure out what it is, or check the extension.
  3. Automagically link php function names and language constants to their descriptions on php.net.
  4. Subdirectories! This is going to get tricky pretty quick if I keep adding to it.

One Response to “Code, Code, Code (and a birthday)”

  1. On October 18th, 2005 at 13:19:02, Schlueterica » Code Folder Upgrade Said:

    [...] Last time, I created two scripts. [...]

Leave a Reply

Comments are moderated like crazy using a variety of plugins. There is a very high likelihood that your comment won't show up right away, especially if you have never commented here before, but it was not deleted.

Please be patient, and do not post your comment more than once. It will show up once it is approved.

You must be logged in to post a comment.