This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 Base26 = require('./base26') | |
| /** The Radix of the Trie. In thise case, base 26 */ | |
| const R = 26 | |
| /** | |
| * An node contains a value and links that point to other nodes. | |
| * @typedef {Object} Node | |
| * @property {any} value | |
| * @property {Array} next |
This file contains hidden or 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
| /** | |
| * A set of static methods governing string-to-int conversion | |
| * in base26. In base26, only lowercase alpha chars [a-z] | |
| * are valid and map to an integer range (0, 26] | |
| */ | |
| module.exports = { | |
| /** | |
| * returns the base26 integer corresponding with the provided char. Note | |
| * that by design uppercase chars may be supplied, and are |
This file contains hidden or 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
| module.exports = function ({ port }) { | |
| const debug = require('debug')('run__on::server::app.js') | |
| const express = require('express') | |
| const path = require('path') | |
| const helmet = require('helmet') | |
| const RateLimit = require('express-rate-limit') | |
| const { internalError } = require('./middleware') | |
| // Configuration ----------------/ |
This file contains hidden or 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
| import javafx.beans.property.SimpleStringProperty; | |
| /** | |
| * Class representing a transit ticket vending machine. This is an example | |
| * and only demonstrates a single property: selecting a transit route. | |
| */ | |
| public final class SlotMachine { | |
| /** | |
| * ROUTES that tickets can be issued for |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <?import java.lang.*?> | |
| <?import java.net.*?> | |
| <?import java.util.*?> | |
| <?import javafx.scene.*?> | |
| <?import javafx.scene.control.*?> | |
| <?import javafx.scene.layout.*?> | |
| <?import javafx.scene.text.Text?> |
This file contains hidden or 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
| import javafx.fxml.FXML; | |
| import javafx.scene.control.Button; | |
| import javafx.scene.text.Text; | |
| /** | |
| * FXML Controller class for SlotMachineTab.fxml | |
| */ | |
| public class SlotMachineTabController { | |
| /** | |
| * SlotMachine Model |