This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const collect = (node, pre, pattern, q) => { | |
if (!node) { return } | |
let d = pre.length | |
if (d === pattern.length && node.value) { q.push(pre) } | |
if (d === pattern.length) { return } | |
let next | |
pattern[d] === '.' | |
? next = '.' | |
: next = Base26.getBase26Digit(pattern[d]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const recursiveInsert = (node, key, val, d) => { | |
if (!node) node = new Node() | |
if (d === key.length) { | |
node.value = val | |
return node | |
} | |
let c = Base26.getBase26Digit(key[d]) | |
node.next[c] = recursiveInsert(node.next[c], key, val, d + 1) | |
return node | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Trie { | |
constructor () { | |
this.root = new Node() | |
} | |
put (key = '', val = null) { | |
this.root = recursiveInsert(this.root, key, val, 0) | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const R = 26 | |
function Node (value = null) { | |
this.value = value | |
this.next = new Array(R) | |
} | |
class Trie { | |
constructor () { | |
this.root = new Node() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// R defined elsewhere | |
function Node (value = null) { | |
this.value = value | |
this.next = new Array(R) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$drawer-width: 80vw; | |
.navigation { | |
&__nav { | |
height: 100%; | |
position: absolute; | |
top: 0; | |
left: 0; | |
z-index: 1000; | |
// this hides the navigation drawer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="navigation"> | |
<input class="navigation__cbox"/> | |
... | |
<nav class="navigation_nav"> | |
</nav> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hamburger-height: 4rem; | |
.navigation { | |
&__cbox { display: none; } | |
&__hamburger-box { | |
width: $hamburger-height; | |
height: $hamburger-height; | |
position: absolute; | |
top: 3rem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.navigation { | |
// ... | |
&__hamburger { | |
margin-top: 2rem; // middle line 'meat' of burger | |
position: relative; | |
// this sets the style for all 3 lines | |
&, | |
&::before, | |
&::after { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.navigation { | |
// ... | |
&__hamburger { | |
margin-top: 2rem; // middle line 'meat' of burger | |
position: relative; | |
// this sets the style for all 3 lines | |
&, | |
&::before, | |
&::after { |