Blog

Or search support forum

What's Global Moxie?

Global Moxie is the hypertext laboratory of Josh Clark, a designer, developer, and author who offers workshops and consulting for iPhone app design. He’s also creator of Big Medium, a web content management system. Josh spins words and code from multimedia studios in Providence, RI, and Paris, France.

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.

State of Josh's Brain

Hanging

Providence, RI

Map of Josh's current location

Snapping

Latest photos