Skip to content

Instantly share code, notes, and snippets.

@hamadu
Last active June 23, 2017 07:06
Show Gist options
  • Select an option

  • Save hamadu/f8fe39591543ebb91d312d51e50541ac to your computer and use it in GitHub Desktop.

Select an option

Save hamadu/f8fe39591543ebb91d312d51e50541ac to your computer and use it in GitHub Desktop.
hoge.md
```
│ const suffixStrings = buildSuffixStringTable(query, suffixOrder)
│ const suffixStringTable = world.table(160, 180, size, size, suffixStrings)
│+
│+ let color = 0
│ for (var i = 0 ; i < nl ; i++) {
│+
│+ if (i >= 1) {
│+ const sub1 = query.substr(suffixOrder[i])
│+ const sub2 = query.substr(suffixOrder[i-1])
│+ if (sub1.substr(0, k / 2) != sub2.substr(0, k / 2)) {
│+ color = 1 - color
│+ }
│+ }
│+
│ for (var j = 0 ; j < k ; j++) {
│ if (j < suffixStrings[i].length) {
│ if (j < k / 2) {
│- suffixStringTable.setStyle(i, j, 'fill', '#ccf')
│+ suffixStringTable.setStyle(i, j, 'fill', color === 0 ? '#ccf' : '#cfc')
│ } else {
│ suffixStringTable.setStyle(i, j, 'fill', '#fcc')
│ }
│@@ -129,10 +140,6 @@
│ world.remove(suffixStringTable)
│ }
│- if (k > nl) {
│- break;
│- }
│-
│ const subStringWithIndex = []
│ for (var i = 0 ; i < nl ; i++) {
│ const suffix = query.substr(i)
│@@ -163,6 +170,10 @@
│ yield("p")
│+ if (k > nl) {
│+ break;
│+ }
│+
│ world.remove(suffixStringTable)
│ }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment