Blog

Or search support forum

What's Global Moxie?

Global Moxie specializes in mobile design strategy and user experience for a multiscreen world. We offer consulting services, training, and product-invention workshops to help creative organizations build tapworthy mobile apps and effective websites. We're based in Brooklyn, NY. Learn more.

On Shelves

Books by Josh Clark

Tapworthy: Designing Great iPhone Apps

Best iPhone Apps: The Guide for Discriminating Downloaders

iWork ’09: The Mising Manual

Moxiemail

Enter your e-mail to receive occasional updates:

And speaking of version control...

Posted Jul 12, 2007 (updated Aug 3, 2007)

If you're developer looking for an easy way to display differences between two different chunks of text, I highly recommend Neil Fraser's diff-match-patch code library. Neil works for Google, and his library is used in Google Documents... and now Big Medium, too.

The open-source library (LGPL license) is available in Java, JavaScript and Python and makes for a great drop-in to add diff support to your app.

Big Medium uses the JavaScript library to diff text versions, and it reduces the whole operation to just four lines of code:

var dmp = new diff_match_patch();
var d = dmp.diff_main(oldText, newText);
dmp.diff_cleanupSemantic(d);
var html = dmp.diff_prettyHtml(d)
Screenshot - Edit history comparison
Click to enlarge.

Sweet.

Tags: ,

Want more? Recent blog entries...

Add a Comment

Don't be shy.

(Use Markdown for formatting.)

This question helps prevent spam:

Download Big Medium
Try it free for 30 days, or buy to unlock.

Brains for Sale

“Josh Clark, do you sell your brain so I can constantly tap into it for wisdom? Oh wait, you wrote a book.
—Tim Van Damme, designer

“Whenever I have a question about iPhone design patterns, Tapworthy has an answer, even for little details. The best book you can buy for iPhone design.”
—Catriona Cornett, inspireUX.com

“Great speaker. Josh Clark could make a talk about cleaning a litter box interesting.”
—Aaron Griffith, iPhone developer