![]() |
Guides Examples Theory |
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
| #!/bin/bash | |
| # Exit on any error | |
| set -e | |
| echo "Creating gRPC RxJS Demo Project..." | |
| # Initialize git and npm | |
| echo "Initializing git and npm..." | |
| git init |
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 React, { useState, useEffect } from "react"; | |
| import "./styles.css"; | |
| import { Chance } from "chance"; | |
| const chance = new Chance(); | |
| /* | |
| Keno cards have 8 rows of numbers with 10 numbers in each row. | |
| Each row starts from the value of the last row + 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
| /** | |
| * Rotate each array item left `d` times. | |
| * @param {array} a - Input array | |
| * @param {number} d - Number of places to rotate each item in array left | |
| */ | |
| function rotLeft(a, d) { | |
| let clone = a.slice(0); | |
| // check empty | |
| if(a.length < 2) return clone; |
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
| { | |
| "editor.tokenColorCustomizations": { | |
| "textMateRules": [ | |
| { | |
| "scope": [ | |
| "comment", | |
| "comment.block", | |
| "comment.block.documentation", | |
| "comment.line", | |
| "constant", |
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
| // Breadth & Depth First search | |
| /* | |
| Example diagram: depth 1 indexed first, then 2, then 3, etc. | |
| 1. ==> A | |
| / \ | |
| 2. ==> B C | |
| / \ \ | |
| 3. ==> D E F | |
| Breadth first searches operate on a cluster of nodes from left-to-right: |
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 Queue { | |
| constructor() { | |
| this.vertices = []; | |
| } | |
| /** | |
| * Adds a vertex to the queue | |
| * @param {any} vertex - vertex to add to the queue | |
| */ | |
| enqueue(vertex) { |
A graph is a collection of nodes/vertices and the edges that connect them
- connected graphs have all vertices connected
- torrent networks as each vertex offers a portion of the files they share
- disconnected graphs have some vertices that have no edges connected
- torrent networks can also be disconnected when a seeder has a file not being shared by any other computer on the network
NewerOlder
