TextMate Makefile Bundle

Posted by matt
on Saturday, August 01

Recently, I’ve needed to write and use various Makefiles. I was disappointed to find the TM’s syntax highlighting lacking, and just not colourful enough, so I set about adding a few bits and pieces.

You can find the result on GitHub.

I was pleased to find that most of the official TM bundles are now there, so if you’re making small (or massive) tweaks and improvements, it’s should now be easier than ever to get your changes merged into TM proper.

My MacHeist Release Estimate

Posted by matt
on Friday, February 06

Like a lot of mac users, I get excited about MacHeist, and why not, it’s fun and a good bargain.

Since we’re snowed out of work, and a MacHeist Bundle release seems imminent, I decided to hack up a quick script to find out how wide the progress bar thing is, and use that to estimate the release time. Here’s what I’ve been up to for the last half hour or so:

MacHeist: Mainframe
Uploaded with plasq’s Skitch!

I used BeautifulSoup with urllib2 and a tiny regular expression, and here’s the result:

I’m running it in a simple shell loop:

  while true; do sleep 60; python heist_parse.py >> heist_countdown; done

Which is collecting the width every minute (that doesn’t seem too often).

Now that I’ve had this loop running for a while I’ve got 34 data points, so I can do a bit of simple linear regression, with scipy. Here’s a graph:

macheist_release_estimate
Uploaded with plasq’s Skitch!

And here’s the code used to do the regression, and generate the plot.

It’s important to remember that this is based on the assumption that the bar is full up at 500 pixels wide. This may or may not be reasonable.

If it is though, I’d tentatively estimate that the bundle will be release at 3AM (GMT) on the 7th Feb 2009. You read it here first!

Update: Well, it looks like they cheated! Here’s a graph of the bar’s length with time:

Rounded up!
Uploaded with plasq’s Skitch!

As you can probably see, it was rounded up. Ahh well. So much for the estimate!

TextMate Plain Text Wiki as an Exocortex

Posted by matt
on Sunday, November 30

I got a copy of Pragmatic Thinking and Learning when it came out a while ago, and I just finished reading it. I really wish I’d read it before I embarked on a PhD!

As my girlfriend pointed out, it is basically a psychology textbook, with an onus on learning, but it’s presented in that great informal, geek-accessible style that you’ll probably only have come across in other pragmatic programmers books.

I have to admit that reading it in bed probably wasn’t the best place, since it made following the advice like “If your software isn’t set up with a safety net (version control, unit testing and automation), you need to get that implemented right away. Put the book down. I’ll wait.” slightly harder to follow, but I still got a heck of a lot out of it, including the idea of an exocortex.

An exocortex is basically an external information-processing memory device thing which augments your brain. Charles Stross’ novel Accelerando (which is available online) will help explain, if you’re interested. For now though, we have to make do with (normal) computers to augment us, so that basically means wikis.

Inspired by a couple of screenshots in Pragmatic Thinking and Leaning, I searched the web for a wiki that runs inside of TextMate, and stored everything in flat files. I found Plain Text Wiki, a bundle which did some of what I wanted, including exporting to HTML, and following links by pressing

I created a fork on GitHub, and set about modifying it. Changes I’ve made include fixing the backend to work on my Mac, copying the matkdown language grammar into it (since TM’s markdown grammar isn’t really extensible), and a wiki mapper.

For the mapper, I’ve used nodebox, and a short script to generate nodebox code and fire it up. The results look like this (and are animated in nodebox):

wikimap
Uploaded with plasq’s Skitch!

Feel free to fork it yourself. I’ve got lots of ideas, like moving to a git based wiki system (like git-wiki), auto-publishing, and using a templating system.

Refactoring Commands in the MATLAB Bundle

Posted by matt
on Saturday, November 22

Sometimes, after seeing a few things, concepts collide (like icebergs, perhaps), and I come up with ideas I think are cool. Here’s one of those:


Refactoring with the MATLAB bundle from Matt Foster on Vimeo.

For those of you who prefer some code, say you have a big long ugly line of code. You know it’s bad, but it works and you don’t want to break it. Here’s an example, very, very loosely based on some Matlab code I saw at work:

The obvious thing to do, is pull out that evil range -pi:0.1:pi. With the new ‘Introduce variable’ command (bound to ⌃⇧C, by default), you can do this be selecting any on of them, and running the command.

You’ll see a dialogue box asking you for a name for you new variable, and after you press OK, you’ll see the following:

Much better. You can also repeat the process to further simplify the line, and the command will insert the new variable before the first instance it finds. Cool hey?!

This command is also general enough that is should work for most languages that use assignments based on =. For more info on this concept, see refactoring.com, which I shall also be scouring for more ideas.

Announcing the IPython TextMate Bundle

Posted by matt
on Friday, November 14

After being shown the huge potential of mixing TextMate with IPython via a little applescript, I started work on the IPython TextMate bundle. I also set up a google group, and talked to the ipython-users mailing list. Their response was great, and they’ve allowed us to discuss the project on the ipython-dev list, if we tag message subjects with [TextMate]. There’s also a possibility that we can distribute the bundle with IPython in the future!

Current features in the bundle are mostly related to interaction with IPython in a Terminal (specifically Terminal.app), and make use of applescript, and include:

  • running the current file in IPython
  • running the current line / selection in IPython
  • running the current file / selection / line in IPython with the profiler enabled
  • toggling the state of the debugger (setting this to ON will switch into the debugger when an exception occurs)
  • entering the debugger
  • adding breakpoints to the current file
  • removing those breakpoints
  • growl notification of salient points
  • rudimentary syntax highlighting of ipythonrc files, including warnings about broken comments (you can’t have a directive and a comment on the same line)
  • commands for editing the ipythonrc file and .ipython directory
  • built in help

Most of these functions are accessed by pressing (⌃⇧I), which gives you a list from which you can select the item you wish to activate. This is similar to the Git / Svn bundles. This means you need only remember one shortcut.

Re: ipython_menu
Uploaded with plasq’s Skitch!

You can grab this now, from GitHub or GetBundles. Please send feedback, ideas or comments to the ipython-dev mailing list, the google group, or directly to me.