Skip to content

Instantly share code, notes, and snippets.

@NHQ
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save NHQ/241d560df4cc4094d512 to your computer and use it in GitHub Desktop.

Select an option

Save NHQ/241d560df4cc4094d512 to your computer and use it in GitHub Desktop.
Every new tab / session at http://node.module.club a new diff record is created. to recover diffs paste something like this into the editor and compile [SHIFT-ENTER]:
allDiffs = store.getAll()
aDiffs = store.get('1427230082405_diffs')
console.log(aDiffs, getDiffByIndex(aDiffs.length - 1))
function getDiffByIndex(index){
var str = '';
for(var x = 0; x < index; x++) {
str = diff.applyPatch(str, aDiffs[x].diff)
}
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment