Recovering from a Bad Mercurial Subrepo State

Earlier today I was checking out a Mercurial repository I setup a while back as a blank template for projects. Unfortunately, my last commit to it was a merge that broke the subrepo state. It also suffered from a typo in the .hgsub file. In short, the repository was hosed because I couldn't update to any of the previous revisions. I kept getting errors like:

cloning subrepo vendor/_src/twig.js from git://github.com:justjohn/twig.js.git
fatal: unable to connect to github.com:
github.com: Servname not supported for ai_socktype

abort: git clone error 128 in vendor/_src/twig.js (in subrepo vendor/_src/twig.js)

and

abort: invalid subrepository revision specifier in .hgsubstate line 5

It took me a lot of searching to find a solution to these problems, so I'm documenting it here in the hope that someone else finds it useful.

Read More

Using Your Browser and HTML5 "content editable" as an Editor

HTML5 has the concept of content editable which allows any DOM element to become a user-editable canvas. All you need to do is add the contenteditable="true" attribute to an element:

<div id="content" contenteditable="true">
</div>

The beauty of this feature is that the content is part of the HTML DOM and can be edited with the chrome inspector, so you have all the power of the inspector to drag and drop nodes, change the element styles from the style panel, etc...

This gives you a fantastic editor to work in with a very minimal amount of code required.

Read More

Transit Widget on Google Play


Android app on Google Play

I never quite got around to posting here, but TransitWidget, an application started at a Google Technology User Group hackathon I participated in a while back is now available for free on Google Play. It supports all bus services that NextBus supports, including the MBTA, MTA and SF Muni. If you like the idea of having a widget on your home or lock screen that displays the time till the next bus, you might like it.