Skip to content

Instantly share code, notes, and snippets.

View jhuiting's full-sized avatar

Jos Huiting jhuiting

  • Mendix
  • Vianen, Netherlands
View GitHub Profile
@creationix
creationix / tree-on-list.js
Last active December 28, 2018 13:50
a hyperdrive inspired data structure for storing FS changes to a log of events.
/*
0 - [foo] [[0][]] time - Add empty folder /foo
1 - [foo,hello] [[1][1]] time meta - Add file /foo/hello
2 - [foo,goodbye] [[2][1,2]] time meta - Add file /foo/goodbye
3 - [foo,man] [[3][1,2,3][]] time - Add empty folder /foo/man
4 - [bar,baz] [[3,4][4]] time meta - Add file /bar/baz
5 - [bar,bit] [[3,5][4,5]] time meta - Add file /bar/bit
6 - [foo,hello] [[5,6][2,3]] time - Delete /foo/hello