create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
/** | |
* Get from a numeric `enum` just `keys` or just 'values' | |
* | |
* Source: https://www.sharooq.com/how-to-access-keys-and-values-of-an-enum-in-typescript | |
* | |
* @param target | |
* @param NumericEnum | |
* @returns | |
*/ | |
export const getNumericEnum = (target: "keys" | "values", NumericEnum: Record<any, any>) => |
/** | |
* Source: https://youtu.be/wsoQ-fgaoyQ | |
*/ | |
export const asyncHelper = (promise) => | |
Promise.allSettled([promise]).then(([{ value, reason }]) => ({ | |
data: value, | |
error: reason, | |
})); | |
/** | |
* Source: https://github.com/TanStack/table/blob/v7/examples/filtering/src/makeData.js | |
*/ | |
import namor from 'namor' | |
const range = len => { | |
const arr = [] | |
for (let i = 0; i < len; i++) { | |
arr.push(i) |
.rainbow-text { | |
background-image: var(--rainbow-gradient,#fff); | |
background-size: 100%; | |
background-repeat: repeat; | |
-webkit-background-clip: text; | |
-webkit-text-fill-color: transparent; | |
-moz-background-clip: text; | |
-moz-text-fill-color: transparent; | |
filter: drop-shadow(0 0 2rem #000); | |
text-shadow: none; |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
Absolute center: absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 |
/** | |
* Decompose integer number by grade | |
* | |
* @param {number} num | |
* @returns {number[]} | |
*/ | |
const decomposeIntNr = (num) => | |
`${num}`.split('').map((itm, i, arr) => itm * 10 ** (arr.length - i - 1)); | |
console.log(decomposeIntNr(346)); // Output: [300, 40, 6] |
/** | |
* Transforms string from any format case in spinal case (ex. spinal-case) | |
* | |
* Source: https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-spinal-tap-case/16078 | |
* | |
* @param {string} str | |
*/ | |
function spinalCase(str) { | |
// "It's such a fine line between stupid, and clever." | |
// --David St. Hubbins |
/** | |
* Generate Random Whole Numbers within a Range | |
* | |
* Source: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range | |
* | |
* @param {number} min | |
* @param {number} max | |
*/ | |
const randomRange(min, max) => Math.floor(Math.random() * (max - min + 1)) + min; |
/** | |
* Compose functions from left to right. | |
* | |
* Source: https://1loc.dev/#compose-functions-from-left-to-right | |
* | |
* Read more by googling: "js pipe", "js pipeline", "js compose from left to right". | |
* | |
* @param {...function} fns | |
* @returns {*} | |
*/ |