Category: Projects

lefnire.js: the weirdest Node.js API consumer ever

It must have all started with a joke on iRC that my friend lefnire, creator of HabitRPG, might just be an advanced Node.js program.

A few weeks later, a buddy and I took this to its logical conclusion.

But even with novelty projects, there are things to be learned, and this project has exposed me to npm modules I probably otherwise never would have used. I’m going to go over a few of the architectural highlights (npm and not) in no particular order.


After you npm install lefnire, typing lefnire runs him.

screenshot of lefnire.js

If you said, “ASCII art?” you would be correct. This was a friend’s idea, and it’s become a staple of the application.

API integration with the superagent and github modules

Currently, lefnire.js is lightly integrated with the HabitRPG and GitHub APIs. The HabitRPG API integration uses straight superagent requests. The GitHub API calls use github.

When you say something containing “habit down,” he makes an API call to to check.

When you ask him by his IRC name (I’ll be getting to IRC stuff in a second), he queries the GitHub API to find out the number of issues labeled “critical” for HabitRPG on GitHub.

IRC integration with the node-irc module

What would an automaton be without being able to log on to IRC and interact? lefnire.js uses node-irc to accomplish this. The library is pretty robust and follows Node.js patterns well. This is a fantastic example of an application that thrives on asynchronous execution. When you ask him if “habit is down,” and it is, that thread of execution will block. However, it won’t stop the bot from responding, thanks to the event listener model implemented by node-irc.

Mood and the Sentimental module

Another interesting feature is a rudimentary implementation of mood, which is basically just a number between 0 and 30 (0’s the best). This doesn’t do too much yet. It affects his behavior a little bit. The number of GitHub criticals is the baseline metric.

This is then adjusted up or down by how positive or negative Sentimental analyzes the up to the 30 most recent GitHub Events from lefnire to be. This is mostly issue comments, pull requests comments, and commit messages.

When lefnire is in-channel, it also adjusts mood based on Sentimental text analysis of what he says.

No database yet, so everything except what I can retrieve again through API calls is lost if I ctrl-C the bot and stop it.


Those are the main highlights of the current implementation. A lot of things are planned. I doubt anyone would want to contribute to this, but I’d certainly be excited to receive some pull requests.

GitHub repository:


Introducing Internationalization 404 for Drupal

I released a new module for Drupal a couple days ago called Internationalization 404. This module helps you automatically use Content Translation-translated localized language versions of your 404, 403, and home pages.

Normally, you have to install Internationalization Variables (i18n_variable) and separately configure the options for these pages per-language. This module saves you time and automatically sends visitors to the correct page. Should you decide to use specific language versions with i18n_variable, this module will respect that configuration and not interfere.

All you have to do is enable the module for it to start working. No configuration required. Disable it to turn off the functionality.

Install it from the project page.

Thanks to Project Ricochet for sponsoring this work.

HabitRPG and Remember the Milk Synchronization on the Command-Line

If you, like me, are a user of both HabitRPG and Remember the Milk, you may have been looking for a way to link the two. I developed habitrpg-todo-sync (HabitRPG Todo Synchronization) to do just that.

The README file explains in good detail how to use it.

Come on, just tell me how to use it

OK, here’s the quick version (you need NPM installed, which you get with Node.js):

npm install -g habitrpg-todo-sync


It will tell you what to do from there.

Full synchronization

You might be interested in running

habitsync -a

to do a full synchronization of your tasks. By default, it only retrieves the last week of them.

Don’t synchronize everything

You may not want to get all your tasks. habitrpg-todo-sync can make use of Remember the Milk’s advanced search interface (ever tried typing something like addedWithin: 1 week ago in their search box?). Here’s how:

habitsync –filter=”list:Name of Your List”

You can do anything you can do with their interface.

And you can combine command-line options:

habitsync -a –filter=”list:Smart List You Want To Sync”

Run on a schedule

You can run it manually or add it to cron. I have this in my crontab, which runs it every hour against (which is often more likely to be working). To put it in yours, you generally run

crontab -e

and then add the following line:

# min hour mday month wday command
*/60 * * * * /usr/local/bin/habitsync -qB

You can separate each argument with spaces or tabs, and you don’t need the first line. I just included it for completeness.

It doesn’t do what I want.

Tell me! I really want to hear back from users of it. When I don’t, I assume nobody cares, and I improve it much more slowly. Report issues on GitHub.

Sponsor Fill PDF’s “Send as Email” Feature

Just a quick note that I’ve started a ChipIn jar for this Fill PDF issue: Automatically email the PDF upon generation.

The amount is just $160. I think this would let me set aside the time to implement this feature or document how to achieve it with existing Drupal modules. I know this has been a “pain point” for a few people (I’ve even had two separate work offers for it!) That’s why I figured that, given a chance to sponsor this, people might be up for it.

All contributors will be thanked personally on my blog, Twitter account, and for a little while at least on the Fill PDF project page.

So why wait? Contribute!

Help shape the Drupal Meetup module

I’ve been trying to drum up interest in a Meetup module for It’d build on the Meetup API module that I released last year.

I’ve started a discussion on Join the Meetup module planning discussion.

With Meetup’s new design, some people have also started talking about using the API to “skin” Meetup in ways people like better. I’m kind of hoping this leads to skin installation profile…but don’t know if it will. Wish me luck in advocating Drupal!

New Meetup API Drupal Module Released

It’s been a week of achievements over here. As I wrote, I accidentally became a co-maintainer of the Fill PDF module, and now I’ve finally released my own. You can view the Meetup API project page.

If you are a developer and want to integrate functionality and data with your site or that of a client, this module might be useful for you. Use it, improve it, contribute code back.


Just released – PHP Meetup API Client Alpha Version

It’s a bit late for me to write much on this, so I’ll write another post later on, but in short:

Pull it down and contribute back if you want to see this grow 🙂 The README.txt that comes with it explains a bit about how it works.

But it doesn’t stop here. Next on the list is its companion Drupal module, of course! And maybe some other stuff as well, but that’s what I have planned so far.