November 14th, 2006

  • evan

billmonk is good software

Friends of mine have occasionally mentioned BillMonk for over a year now, but I finally sat down to settle my debts to my roommate with it last night. I'm pretty pleased with it. It has a sensible and intuitive interface, a hint of DHTML but it's not conspicuous about it, and they seem to have gotten the details right.

Some bits I've liked:
  1. When I registered, it included instructions on how to associate my cell phone with my account (one of their usage models is that you can report who paid for dinner directly from the restaurant).
  2. Someone submitted a debt I owed them via my work address. The "you have been invited" email included a note saying "if you already have an account, here's how to merge this debt/email address into your existing account".
  3. The EFF loves their privacy policy.
Functional yet unobtrusive, a perfect example of a social application that works best on the web.
  • evan

ruby wart: escaping apostrophes

Suppose I wanna escape all apostrophes with a backslash.

1. "a'b".gsub(/'/, "\'") ⇒ "a'b" — doesn't work, as \' evaluates to ' in double quotes)
2. "a'b".gsub(/'/, "\\'") ⇒ "abb" — \' is special for gsub (!!!)
3. "a'b".gsub(/'/, "\\\'") ⇒ "abb" — by #1, the \' expands into the same string as #2
4. "a'b".gsub(/'/, "\\\\'") ⇒ "a\\'b" — this works, but ew. And it's not even clear to me why it works. (The output looks wrong but remember Ruby is pretty-printing the single \ as \\ in the output.)

The best way to do it?
Collapse )