Welcome to my little corner of the Interweb. This is my metaphorical scratchpad, soapbox, and junk drawer. And hey, while I’ve got your attention: my company is hiring developers and designers!

Photo by Roasting Plant

On a visit to New York City last week I had the pleasure of stopping by the Lower East Side branch of Roasting Plant, which has to be the ideal coffee place for geeky perfectionists like myself. The coffee is roasted in small batches on-site. When you place your order, the counter clerk touches the screen, and whoosh! a measured amount of your selected coffee beans are whisked through pneumatic tubes over your head, directly into an automated espresso machine that grinds, tamps, and brews the coffee. It’s like the canteen at the Willy Wonka factory. Oh, and the coffee tastes good, too.

Comments

Where do you put the global settings for your Rails application? There are several “app config” plugins out there, but they seem too complicated to me. I just want the following:

  • Store configuration data in a YAML file checked into Git.
  • Store more sensitive configuration data in environment vars or Heroku config.
  • Simple access, no magic: AppConfig['key.subkey']

This is so simple it isn’t even a plugin, just a file to stick in the lib dir and require.

Comments

I’ve been trying out various in-browser template libraries, like mustache.js and jQote, where you put HTML templates into <script type="text/html"> tags. The browser is required to ignore them, since text/html isn’t a scripting language, but you can use regular editing tools on them, which isn’t true if the template is inside a JavaScript string as in other template libraries.

I also like using Haml to generate HTML, and it turns out these two things aren’t quite compatible out of the box. The trouble is the CDATA section that’s required to keep the HTML valid in this scheme. You can’t do this:

<script id='foo_tmpl' type='text/x-mustache'>
  <p>This is Haml enclosed in CDATA.</p>
  <p>You can use it for templating {{stuff}}.</p>
</script>

Just as you have to escape < in a JavaScript script tag, you have to do it in a template script tag. Or, much easier, you can surround the contents with CDATA tags like so:

<script id='foo_tmpl' type='text/x-mustache'>
  <![CDATA[
    <p>This is Haml enclosed in CDATA.</p>
    <p>You can use it for templating {{stuff}}.</p>
  ]]>
</script>

Unfortunately, there’s no built-in way to do this and use Haml to write the inner HTML. There’s a :cdata filter in Haml, but it takes the contents literally.

To get around this, I wrote a :hamlcdata filter that runs the contents through Haml, then surrounds the output with CDATA tags. It’s a bit fragile, because I had to turn off #{} interpolation (that needs to happen in the inner Haml run), and there’s no way to do that with the stable API. I had to override the compile method, which means this code may need to be revised if Filters::Base#compile changes. However, since the change was simply to delete some code (commented out below), it shouldn’t be too hard to keep up.

Comments

Microsoft has released the Consolas font for users of Visual Studio 2005. As far as I’m concerned this is a must-have if you spend any time looking at code.

And now for an extra trick: how to use Consolas as your console window font. Run this command to add Consolas as a valid console font:

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 00 /d Consolas

Then reboot, and choose Consolas in the console window preferences.

Comments

As predicted by James Oberg in his fine article Seven myths about the Challenger shuttle disaster, the New York Times continues to propagate the myths in their homepage blurb at right—though they only had room to include two of them.

As Mr. Oberg says:

The flight, and the lost crewmembers, deserve proper recognition and authentic commemoration. Historians, reporters, and every citizen need to take the time this week to remember what really happened, and especially to make sure their memories are as close as humanly possible to what really did happen.

Comments