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
Follow the Grid, Skip the LinesMy post office features a clever heat-map grid to announce slow and busy hours. A perfect idea for the web.
C’est la BeachAs Paris morphs into the Riviera, some clever icon design works its own transformation.
Amazon Image BookmarkletsAdd these to your browser for easy access to large images of book covers, album art or commercial products.
No Pain, No Pain: The “Couch to 5K” and Humane DesignI wrote the "C25K" training program for new runners over a decade ago. Its philosophy overlaps neatly with my philosophy of software design.
Is Your Service Plan about to Expire?Your service plan gives you free upgrades for Big Medium. Be sure that you're up-to-date before your plan expires, and find out details about how to renew.
Plug for the New PluginsThree new Big Medium plugins let you create multi-page articles, add watermarks to images and boost publishers' library permissions.
ControlledYour faithful correspondent fell under the browbeating eye of authority on a few recent and essentially trivial occasions, making me think a bit about the effects of control, rule enforcement and tone in my own work.
Design Treasures Found and Lost in the Paris MétroTons of cool historical design in the Paris subway is getting gutted.
Big Medium T-ShirtsSlap a genie on your chest, and be a Big Medium superhero.
Add a Comment
Don't be shy.