Stephen Newey

Elegant ideas, hastily implemented.

Keep Compiling CoffeeScript in OS X

Lately I’ve been producing a lot of code in JavaScript. I use the word produce, because I’ve actually been writing the code in CoffeeScript. It better suites my Python sensibilities and is usually half the size of the resultant JavaScript.

The CoffeeScript compiler has a handy feature where it can watch a directory for you and any new or modified files are instantly compiled into JavaScript. By default these land next to their CoffeeScript originals, or optionally in a separate location.

CoffeeScript is brilliant, but using it has also resulted in wasted time trying to debug new code. I wondered why it didn’t seem to be doing anything only to realise I hadn’t started the compiler this session. None of my lovely new code was making it to the browser.

Hello.

Hi. I’m Stephen, and this is my blog. I’ve lost count which iteration of it this must be. My enthusiasm for keeping such things up to date seems to wane pretty quickly. I’m hoping this time might be different.

Recently I’ve been learning and using some interesting technologies for work projects. And in the process I often find myself looking for simple walkthroughs of various things, or discussions of good practice and implementation methods.

With some of the bleeding edge stuff that’s not always easy to find. And so I find myself piecing together slowly how to do the things I need to do, often getting to a certain point and then starting from scratch as that magical glimmer of understanding comes into focus.

In the interests of being able to remind myself of these advances, and in the dual hope that writing them down will bring me to a greater understanding and prove helpful to someone other than myself, I’m going to try and document here as much as I can.

Following in the footsteps of Matt Gemmell, I’ve setup the really rather brilliant Octopress to build the site, baked into static HTML. This runs from a Git repo sitting on my server, and I’m writing articles in Markdown directly on the server via SSH using VIM, which I recently began using.

I’m writing this post as an experiment. Last week I gave into the pixels and bought a ‘new’ iPad and was wondering if I could use it to create stuff as well as consume it. And so right now I’m SSH’d from it using Panic’s excellent Prompt client.

And guess what? I just typed this post with it! It wasn’t a super awesome experience, but it was doable and not unpleasant. And VIM is a great editor for the task, thanks to the ease with which it can jump around the text several words, sentences and paragraphs at a time.

Next up, I need to get to grips with some more advanced use of screen (or byobu if that’s what the cool kids are using these days)…

If, like me, you’ve contented yourself editing your code in TextMate on your Mac and poking at your server configs with nano, watching others with a mixture of fear and awe as they jumped around their documents seemingly pressing Esc on every other keystroke, then you are right to feel those things. But you can be that guy or girl too, install MacVim or GVim and head on over to the excellent vimcasts.org to get yourself started.

With a little practice and patience, you too can be a fear and awe inspiring Esc key ninja. I’m not even very good at it yet, and I can’t imagine going back.

Postfix for Development and Staging Servers

Sometimes we’ll have a client who sends tens of thousands of emails a day from their production systems. And that client insists on copying over their production database to their development server, unmodified each night.

They probably won’t want to send test emails to their real customers, and they’ll probably blame us if this happens. So, what can we do?

Postfix gives us a couple of ways for limiting the destinations it’ll allow emails to be sent to. I like to implement both, just to be sure.