Skip to content

Instantly share code, notes, and snippets.

Retrospective on Migration

To make this migration easier to understand I have split the parts of the upgrades into sections

Dependencies compatibility checking and resolution

  • Update node to lts/hydrogen or node v18.20.8
  • Install the latest version of yarn, yarn 4.6.3 at the time
  • install nvm
@AlexJuarez
AlexJuarez / mongodb-example.js
Created June 29, 2022 12:29
a example query
// 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:[email protected]/admin';
class Heap {
constructor(comparator) {
this.arr = [];
this.compare = (i, j) => comparator(this.arr[i], this.arr[j]);
}
get size() {
return this.arr.length;
}
@AlexJuarez
AlexJuarez / .gitconfig
Last active July 6, 2020 19:21
Git and Vim config files
[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
@AlexJuarez
AlexJuarez / Search.js
Created June 20, 2020 01:14
Find in 2d matrix
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],
];
/**
* @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));
const ws281x = require('rpi-ws281x-native');
const EventEmitter = require('events');
function parse(i, min, max) {
const num = Number(i);
if (isNaN((num))) {
return min;
}
@AlexJuarez
AlexJuarez / FastPixel.js
Last active March 14, 2019 21:13
Mative ws2812b bindings wrapper.
const ws281x = require('rpi-ws281x-native');
const EventEmitter = require('events');
function parse(i, min, max) {
const num = Number(i);
if (isNaN((num))) {
return min;
}
@AlexJuarez
AlexJuarez / Path.js
Last active October 31, 2018 18:03
Ast walker and modifier
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 || [])];
{
"workbench.iconTheme": "vscode-icons",
"editor.tabSize": 2,
"terminal.integrated.fontFamily": "Source Code Pro for Powerline",
"window.zoomLevel": 0,
}