Sticky Notes

Handle changes made in wrong git branch

This happens very often when you forget to create a new branch and make some changes in the same branch.

This will create a new branch named “new-branch” and move all your changes to it.

git switch -c "new-branch"

Get random number withing a range in JS

//min - inclusive, max - exclusive
function getRandom(min, max) {
    return Math.random() * (max - min) + min;
}

//random integer
function getRandomInt(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
“Let yourself be silently drawn by the strange pull of what you really love. It will not lead you astray." - Rumi