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
// MongoDB Playground | |
// To disable this template go to Settings | MongoDB | Use Default Template For Playground. | |
// Make sure you are connected to enable completions and to be able to run a playground. | |
// Use Ctrl+Space inside a snippet or a string literal to trigger completions | |
// Select the database to use. | |
const { MongoClient } = require("mongodb"); | |
const uri = 'mongodb+srv://regen:Ba6qFCPCctcvW8DHavCu@regen-staging.fmfup.mongodb.net/admin'; |
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 Heap { | |
constructor(comparator) { | |
this.arr = []; | |
this.compare = (i, j) => comparator(this.arr[i], this.arr[j]); | |
} | |
get size() { | |
return this.arr.length; | |
} |
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
[alias] | |
s = status --short | |
cam = commit -a --no-verify -m | |
cm = commit --no-verify -m | |
l = !git log --oneline -n 10 --color | cat | |
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort | |
br = branch -av | |
unstage = reset HEAD -- | |
b = !git branch --color | cat | |
bd = branch -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
right. | |
const exampleMatrix = [ | |
[ 1, 2, 6, 10, 17], | |
[ 3, 5, 8, 12, 19], | |
[ 7, 9, 13, 15, 24], | |
[11, 14, 16, 20, 26], | |
[18, 22, 25, 29, 30], | |
]; |
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
/** | |
* @param {string} color | |
* @return {string} | |
*/ | |
const doubles = new Array(16).fill(0).map((_, i) => i * 17); | |
var similarRGB = function(color) { | |
const red = binarySearch(doubles, toRGB(color)); | |
const blue = binarySearch(doubles, toRGB(color, 2)); |
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 ws281x = require('rpi-ws281x-native'); | |
const EventEmitter = require('events'); | |
function parse(i, min, max) { | |
const num = Number(i); | |
if (isNaN((num))) { | |
return min; | |
} |
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 ws281x = require('rpi-ws281x-native'); | |
const EventEmitter = require('events'); | |
function parse(i, min, max) { | |
const num = Number(i); | |
if (isNaN((num))) { | |
return min; | |
} |
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 Path { | |
constructor(node, parent = null, key = null) { | |
this.node = node; | |
this.parent = parent; | |
this.key = key; | |
} | |
replace(node) { | |
node.leadingComments = [...(this.node.leadingComments || [])]; | |
node.trailingComments = [...(this.node.trailingComments || [])]; |
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
{ | |
"workbench.iconTheme": "vscode-icons", | |
"editor.tabSize": 2, | |
"terminal.integrated.fontFamily": "Source Code Pro for Powerline", | |
"window.zoomLevel": 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
// The other player starts with a code that you are trying to guess | |
// the code is 4 digits 1-6, on each guess the other player will | |
// tell you the number of digits in your guess that are in the final solution | |
// and the exact number of digits that matches. | |
// e.g. code: '1234', guess: '1111' => '1 1' | |
const parse = (code) => code.split('').map((n) => parseInt(n, 10)); | |
const MASTER_CODE = parse('1234'); |
NewerOlder