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)
Sweet.
Tags:
programming,
versioncontrol
Want more?
Recent blog entries...
More from this section
DesknotsMore and more, when we refer to mobile, what we really mean is “non-traditional computing devices and environments,” a stodgy mouthful that really boils down to
not the desktop. We need a new term for our sprawling landscape of devices.
A Day Made of GlassThe folks at Corning put together a heckuva concept video that peeks into the near future of touchscreen interfaces.
Designing for TouchThe good folks at .net magazine indulged me by letting me grace their website with a slew of guidelines for touch design.
QR Codes Are Footnotes, Not AdsGo figure, but pulling someone through a QR code means we have to give people information they actually want or need.
Gifts for Designers, Nerds, and Mobile MavensMy own Amazon wish list might offer some inspiration for your nerd, too.
Gestures in #NewNewTwitterBig changes are afoot in the new Twitter app for iPhone, with both good and bad things happening with the app's gesture interactions. Here's a hard look.
Board GamesI just joined the advisory boards of two outfits I very much admire, and I'm looking forward to contributing to the bright future of both.
Eve's WirelessA 1922 silent movie shows off perhaps the first mobile phone, "Eve's Wireless," a contraption that required a fire hydrant and an umbrella to work.
Making StuffThe iPad is a device suited for sitting or reclining, which certainly makes it a device of contemplation, and yep, that's the perfect state of mind for reading or watching a movie. But it's a mistake to think of it as "only" a new-fangled book or tv screen. Contemplation is not the same as passivity.
Tapworthy in China (and Japan! and Spain!)“Touch People's Hearts” is the translated title of the Chinese edition of my book Tapworthy (
触动人心), and I couldn't be more tickled.
More blog posts »
Add a Comment
Don't be shy.