Highrise note export script

Highrise note exported to HTML

Highrise has become the definitive repository for everything I do at work. It’s a perfect tool to track the whirlwind of activity and action items that make up day-to-day work.

After getting into the rhythm of using it for a while, I noticed that I often needed to share a note that I’d captured with my boss or another team member. In the past, I had occasionally used Writeboard to bang out these types of notes, exporting them to HTML and sending them as e-mail attachments if need be. After the third or fourth time, wheels started to turn in my head.

So, I wrote a simple Ruby script to combine the two concepts and export a Highrise note to an HTML file. To use it, you’ll need to do the following:

  1. Download the script and edit it to include your Highrise account info (URL and API key).
  2. Install the Ruby BlueCloth gem…this step can be tricky.
  3. (Optional) Create a shell script to launch the Ruby file and pass it the command line parameter.

If you go the extra mile and do step 3, you can use a shorthand syntax on the command line (e.g. hrn 8675309) to run the script. The numerical parameter represents the ID of the note, which you can see in your browser’s Address bar when viewing the full details of said note. The exported HTML file will be created in the current directory.

Writeboard vets will notice the degree to which I’ve ripped off been heavily inspired by its export function. The notable area in which I’ve differed is to use Markdown instead of Textile for formatting. I really like both, actually, but I think Markdown looks less “markup-y” if you’re looking at the source, which will be the case whenever I’m in Highrise.

Obviously, it would be ideal if my co-workers and I could all login to a shared Highrise account and view these notes without exporting. But since we’re not at that point yet, I’m happy that the Highrise API is so easy to use and I can build my own workaround.


Installing BlueCloth: Use Markdown in Ruby on the Mac

If you find yourself writing text that you’ll eventually post to the web, hopefully you’ve heard of text-to-HTML translators like Textile and Markdown. These tools take plain text formatted with a very light syntax of special characters that can generate formatting like bold text, bulleted lists, and so forth.

I am a big fan of Textile and use it frequently when I set out to write something new that I plan to post to the web (like this post). I’m coming around to see the value in Markdown, however, because it does a better job of taking existing text and translating it to HTML without any manual cleanup. It works especially well when copy-pasting text in e-mail that you want to post online.

Both of these are very useful when writing web applications, since they allow you to convert plain text input from the user into something formatted when displayed in the browser. I’ve used them both from within Ruby scripts, but unfortunately there seems to be an issue with the Ruby gem port of Markdown (BlueCloth). The standard gem install does not seem to do what’s necessary to allow you to use BlueCloth in your own apps or from the command line. (RedCloth doesn’t have this problem.)

So, here’s what I did to get around it…first, install the gem.

sudo gem install bluecloth

If you hit an error on that step, follow this tutorial for installing Ruby on your Mac. Then, run the BlueCloth installer.

sudo ruby /usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/install.rb

At this point you should be able to use BlueCloth from within your own Ruby scripts. But let’s take it a step further and enable the bluecloth command line app.

sudo chmod +x /usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/bin/bluecloth

At this point it’s runnable, but it still needs to be added to your PATH. Add the following line to your .bash_login file:

export PATH="/usr/local/lib/ruby/gems/1.8/gems/BlueCloth-1.0.0/bin:$PATH"

Woo hoo! You can now use BlueCloth in your Ruby apps and call bluecloth directly on the command line.

Note: According to the documentation, RedCloth is supposed to be capable of rendering Markdown-formatted text via additional options. I could not get this to work, and from what I have read not all of the Markdown syntax is supported anyway.

Automated backup to Strongspace with rsync, Automator, and Highrise

Not long ago, I switched to TextDrive after being let down by a cheaper web host. So far, it’s been great…it’s a lot more feature rich and the people over there really know what they’re doing.

The basic $8/month plan includes access to 5GB of file storage for backup/sharing/whatever. I use it to back up regular ol’ documents and files on a daily basis.

They make this easy to do with a UNIX tool called rsync that compresses and transfers only the files that have changed. rsync is the real workhorse here, but I’ve rigged up a backup solution that utilizes all of the following tools:

  • rsync – does the actual file transfer
  • ssh keys – used to avoid entering manual passwords, which enables scripting
  • Automator – ties together the scripts into an application
  • iCal – enables scheduling of the application
  • Growl – provides notification onscreen that the script ran
  • Highrise – keeps a running history of the activity and provides RSS access

To cut to the case, download this file and check out the scripts. For more detail, read on.

This idea uses the UNIX philosophy of employing many small tools each perfectly suited for their job. (I love it.) Let’s take it step by step.

  1. rsync – It’s easy to familiarize yourself with this portion, since you can run it “interactively” on the command line. I do something very similar to what this gentleman did, though I supply slightly different options to rsync as per the recommendations of the Strongspace folks.
  2. ssh keys – If you play with rsync for a while, you’ll see that it asks for a password when you run it. Since we want to script this, we can’t have that, now can we? Fortunately it’s easy to generate ssh keys, which basically make your computer and your Strongspace account “trust each other” so that checking ID isn’t necessary.
  3. Automator – This part is pretty easy…I use Automator in OS X to string together the basic sequence of steps: backup the files, send the log to Highrise, and flash a Growl notification. Download this file to check it out.
  4. iCal – I chose to use iCal to schedule the Automator action (using this basic method) rather than a daemon like cron because it seemed like a more natural, Mac-like fit.
  5. Growl – I’ll be honest, this step is mostly for fun…Growl is just good times. However, I do use it as a quick validation that iCal lauched the script.
  6. Highrise – Growl is cool, but it didn’t provide much in the way of detail as to what happened with the script. I kinda wanted to see a log of what happened, except I didn’t feel like managing log files. I was really looking to get the log info via RSS, and for that I had to post it to the web somewhere. Highrise solves all these issues, and the default Dashboard view is great in the way it highlights the latest info. (After all, I really don’t care about yesterday’s backup after today.) My script e-mails the contents of the log file to my Highrise Dropbox, which was really easy to do with just a few lines of Ruby code.

So far, this has worked without a hitch, and I feel much better having my files backed up everyday.

FeedFlare for Feed Circulation

UPDATE: Please refer to this version instead, which is updated and ready for use!

I guess it is a small world after all. A while ago I created a FeedFlare to make it easier to post your articles to digg. Wouldn’t you know it, I’m surfing the web a few days ago, minding my own business, and I see that not only is someone else actually using this FeedFlare, but posting the item to digg caused a huge traffic spike to his web site! As John ‘Hannibal’ Smith used to say, “I love it when a plan comes together.”

So, I was inspired to create another FeedFlare: Feed Circulation. If you’re lucky enough to get your item on the digg home page, this is an easy way to watch your numbers go through the roof. 😉

This FeedFlare is dynamic (meaning there’s actual code that makes it work) and uses FeedBurner’s Awareness API. So, before you use it, you’ll need to enable Awareness API access to your feed.

How can I use this for myself?

  1. Download and install this Rails app on your web host.
  2. Create a FeedFlare XML file to point to the app and include the relevant URLs, as in
  3. Login to your FeedBurner account.
  4. Go to the Optimize tab.
  5. Click FeedFlare in the left menu.
  6. Copy/paste the XML file’s URL into the text box under Personal Flare and click Add New Flare.
  7. Scroll down to the bottom and click Save. (This is easy to forget.)

This doesn’t seem to work for me.

I tried to keep this pretty simple to avoid any problems, but, hey…stuff happens. To that end, I wrote this in such way that you can “debug” this a little with any web browser. If you’re having issues, hit this URL:


(Make sure to include the full URL.) You might see an error message like the following:

Error occured (1): Feed Not Found

The error code 1 and the message Feed Not Found are returned from FeedBurner and can be looked up on this page. They’re informative, if not exactly verbose, and they should help you pin down what went wrong.

If you see a tiny snippet of XML that tells you how many subscribers you have, you’re good to go.

How does this work?

Three words: Ruby on Rails.

It’s pretty straightforward, really…it grabs your feed URI from the full feedUrl and makes a call to the FeedBurner Awareness API to pull up the number of subscribers. That number is embedded in the XML the code returns, which is then parsed and displayed in your feed or on your site.

To give credit where credit is due, the code to parse the XML returned by FeedBurner was aped from the Ruby wrapper for the Backpack API, written by DHH himself.


FeedFlare: Printer-Friendly view

I got the itch to do some more coding recently, so I decided to knock out a FeedFlare I had planned on doing for a while: Printer-Friendly view, from on FeedBurner’s list of 101 Flares. What it does is hardly a mystery: it generates a simple, printer-friendly view of a given item in your feed.

How can I use this for myself?

If your blog is powered by Typo, the blogging engine written in Ruby on Rails, this will work for you without modifying the code. Just do the following:

  1. Download and install this Rails app on your web host.
  2. Create a FeedFlare XML file to point to the app and include the relevant URLs, as in
  3. Login to your FeedBurner account.
  4. Go to the Optimize tab.
  5. Click FeedFlare in the left menu.
  6. Copy/paste the XML file URL into the text box under Personal Flare and click Add New Flare.
  7. Scroll down to the bottom and click Save. (This is easy to forget.)

If you’re using one of the other blogging engines, you’ll need to download the code and tweak it to account for differences in XML formatting. That being said, if you do plan to run the code on your own, just get in touch with me by posting a comment and I’d be happy to help you change the code to work with your blogging platform.

This doesn’t seem to work for me.

Again, this is probably because the XML format of your blog’s feed is slightly different than the format expected by the code. For example, the output from WordPress has slightly different structure.

You can also try to “debug” this to some extent with your web browser. If you’re having issues, hit this URL:


This provides a way to preview what your printer-friendly view will look like outside the context of FeedFlare.

How does this work?

First, it makes an HTTP call to pull down the feed itself, then does some XML parsing to look for the item that matches the permalink. Then, it displays the core item data in a simple web page. Done and done.

So, put another FeedFlare up on the big board. And, please leave comments if you have any.

RSS feed of Backpack Reminders

I thought it might be fun to get my Backpack Reminders syndicated as an RSS feed, for easy sharing outside of a calendar. So, I whipped up a little Rails app to do just that.

How can I use this for myself?

This requires that you have a web hosting account with a provider that supports Ruby on Rails. If you’re in the market for one, I’ve been really happy with my experience at Joyent.

The other thing to watch out for here is security. You don’t want anyone who can guess the URL to be able to read the feed. So, I embedded a security token in the URL that is “unguessable” for all intents and purposes. Also, I avoid storing that token in the source code in clear text by using a standard encryption algorithm.

To use this, the steps are more or less as follows:

  1. Download the Rails app.
  2. Edit the file app/controllers/feed_controller.rb to include your Backpack username and API key.
  3. Choose a security token to be embedded in your feed’s URL. In this example, let’s pretend it’s mytoken.
  4. Generate the SHA-1 hash of your security token. On a Mac, this can be done in Terminal with echo -n mytoken | openssl dgst -sha1. Put this value in the appropriate spot on line 6 of feed_controller.rb.
  5. Change the text blurbs in app/views/feed/rss.rxml to pretty-up the display of the feed.
  6. Upload the Rails app to your web host and test the URL. It should be something like http://myhost.com/reminderfeed/feed?sectoken=mytoken.

How does this work?

The Backpack API makes it a breeze to access your reminders in Ruby, and Rails makes it easy to serve an RSS feed. This is basically the minimum amount of glue need to connect the two. If you’d like more details, the files of interest are app/controllers/feed_controller.rb and app/views/feed/rss.rxml.

If you look at rss.rxml, you’ll notice that I ran into a time zone gotcha because my web host is in a different time zone then my Backpack. If anyone has suggestions on how to improve this, please leave a comment and get in touch.

Create Backpack reminders via e-mail/SMS

It’s no secret that I’m a huge fan of Backpack. And though it’s great to store all my miscellaneous info and personal mini-projects in one central location, I’d forget to do anything without Backpack’s reminders feature. It’s simple and it works beautifully.

The one problem I have with Backpack reminders is that I almost never think of the things I need to be reminded about when I’m sitting at a computer. So, what I’ve done is whipped together a quick Rails app that gives me the ability to create Backpack reminders via e-mail or SMS. Here’s how it works:

  1. Realize that you haven’t called Aunt Betty in a while.
  2. Whip out your phone and type call aunt betty sat aft into a new text message.
  3. Send the message to “remindme@mydomain.com”.
  4. The script I wrote picks up the message and sets a Backpack reminder for Saturday at 2pm with the text call aunt betty.
  5. Go about your business until Saturday afternoon, when your Backpack reminder fires off, and alerts you either by e-mail or SMS.
  6. Call Aunt Betty and stop feeling guilty.

You can use any e-mail program to send a reminder message to the “remindme” address, which is handy when you’re in front of a computer. The SMS example above relies on the feature most cell phones have in which a text message sent to an e-mail address magically “becomes” an e-mail.

You can enter the date and time in either order. Here are some other examples:

  • Call Dave (reminds you in three hours)
  • Pick up dry cleaning 5pm wed (time comes before date…that’s OK)
  • Make doctor's appt tom (reminds you tomorrow at 9am)
  • Pick up dinner 5pm (reminds you today at 5pm)
  • Send in taxes 4/15 9:30am (You do pay your taxes, right?)
  • Report for active duty 9/1/07 15:00 (Sept 1st of next year at 3pm)
  • Post files soon (reminds you in 10 minutes)

Those of you that use Backpack reminders already will recognize morning and afternoon corresponding to 9am and 2pm, respectively. I also added the keyword of night (or nite or even nit) to translate to 6:45pm. Call Dave later will work the same as Call Dave, reminding you in three hours. I also added soon to remind me in 10 minutes because you’d be surprised how quickly something flies out of my brain. Finally, you can enter the input text into the subject line of the e-mail or the first line of the body itself.

How can I use this for myself?

This is the tricky part. Essentially, you will need a web hosting account to make use of this. The script is written to work with my (awesome) host, Joyent, which can be configured to call the script when an e-mail comes in and feed it the message. This is definitely the most reliable way to do this and I highly recommend it.

If that doesn’t scare you, just download the Ruby script and configure your web host to launch it when an e-mail arrives at a certain address. In my case the message is passed to the script via good ol’ STDIN.

How does this work?

The parsing was not that hard, really, because Ruby’s such a cool language and has so many great features baked right in. This definitely would have been a bigger pain to write in Java, severely reducing the fun factor. Also, I’ll note that this took me about a week of nights and weekends to put together, and I’m not a Ruby expert.

I need to give credit where credit is due and point out that this was possible to put together because the good people at 37signals have released a really nice API for Backpack. But, more than possible I’d say it was easy to put together because they went one step further and created a sweet Ruby wrapper that made the Backpack calls drop-dead simple. The only way they could have been better is to add this feature into the official Backpack product and render my silly hackery irrelevant. (Hint hint!)

One gotcha: since there’s no way to determine which time zone your Backpack is in through the API, you may have to hard code some stuff in there to offset if your web host is in a different time zone than you.

Happy Backpacking!