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
| ;; The goal of this program is to draw a pyramid in the terminal with a given height. | |
| ;; | |
| ;; Examples: | |
| ;; | |
| ;; β height = 1 | |
| ;; | |
| ;; β | |
| ;; | |
| ;; β height = 2 | |
| ;; |
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 toy implementation of the Resequencer pattern from Enterprise Integration Patterns. | |
| https://www.enterpriseintegrationpatterns.com/patterns/messaging/Resequencer.html | |
| */ | |
| const createResequencer = (destination) => { | |
| const buffer = {}; | |
| let next = 1; |
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
| /* | |
| The goal of this exercise is to render an org chart | |
| in your terminal output based on a list of manager- | |
| employee relationships. | |
| Given the following relationships: | |
| [ | |
| { managerId: 1, employeeId: 2 }, |
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
| (function sayHello(count = 50) { | |
| if (count === 0) return; | |
| console.log("hello world"); | |
| sayHello(count - 1); | |
| })(); |
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 ROMAN_VALUES = { | |
| I: 1, | |
| V: 5, | |
| X: 10, | |
| L: 50, | |
| C: 100, | |
| D: 500, | |
| M: 1000 | |
| }; |
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 words = require("./words.json"); | |
| const readline = require("readline"); | |
| const EVALUATION = { | |
| GOOD: "\x1b[32mβ \x1b[0m", | |
| CLOSE: "\x1b[33mβ \x1b[0m", | |
| BAD: "\x1b[31mβ \x1b[0m" | |
| }; | |
| const evaluateChar = (wordChars) => |
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
| /* | |
| Monte Carlo Simulation for π² π² | |
| Example output for 1,000,000 simulations | |
| 2: β¬β¬β¬ | |
| 3: β¬β¬β¬β¬β¬ | |
| 4: β¬β¬β¬β¬β¬β¬β¬ | |
| 5: β¬β¬β¬β¬β¬β¬β¬β¬β¬ | |
| 6: β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬ |
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
| // definitions | |
| const toLines = logs => logs.split("\n"); | |
| const notEmpty = line => line.trim(); | |
| const toParts = line => line.split(" "); | |
| const toLogEntry = parts => ({ | |
| path: parts[parts.length - 2], | |
| status: parseInt(parts[parts.length - 1]) | |
| }); |
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
| /* | |
| height = 6 | |
| .....β | |
| ....βββ | |
| ...βββββ | |
| ..βββββββ | |
| .βββββββββ | |
| βββββββββββ |
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
| /* | |
| [1] => 1 | |
| [1, 2] | |
| [4, 5] => 1, 2, 5, 4 | |
| [1, 2, 3] | |
| [4, 5, 6] | |
| [7, 8, 9] => 1, 2, 3, 6, 9, 8, 7, 4, 5 |
NewerOlder