Syntax:
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
/** | |
* Create a function that transforms an index into an pseudo-random value, where the values are tied to a string | |
* @param salt string, must have at least one [a-z0-9] character | |
* @param parseVal [optional] function(val: number, i: number, saltRange: [number, number]) to transform the salt result | |
* @returns function(idx: number, skipParse: boolean = false), will always return the same value for the specific SALT and IDX | |
*/ | |
const getSaltedRandomFn = (salt, parseVal) => { | |
const safeSalt = (salt || "").replace(/[^a-z0-9]/gi, "").toLowerCase(); |
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
/* const */ dotsMadeStoreArr = []; | |
function attachOnClickMakeDotsListener(elm) { | |
function onClickMakeDotsListener(evt) { | |
onClickMakeDots(evt); | |
} | |
elm.addEventListener("click", onClickMakeDotsListener); | |
return function detachOnClickMakeDotsListener() { | |
elm.removeEventListener("click", onClickMakeDotsListener); |
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
/** | |
* Receives a part of the document and returns a validation digit | |
* Used mostly for CPF or CNPJ | |
* | |
* Ex.: | |
* getVerificationDigit("000000001") // 9 | |
* getVerificationDigit("0000000019") // 1 | |
* getVerificationDigit("100200300") // 8 | |
* getVerificationDigit(1, 9) // 9 | |
* getVerificationDigit(19, 9) // 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
function generateCsv(params) { | |
const { colsDef, rowsDef, withHeaders, asString } = params || {}; | |
const formatNumber = (val, intDigits = 1, decDigits = 0) => { | |
if (isNaN(val)) return ""; | |
return (+val).toLocaleString(undefined, { | |
minimumIntegerDigits: intDigits, | |
minimumFractionDigits: decDigits, | |
}); |
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
function randomRange(min=0, max=100, dec=0) { | |
const mag = 10 ** dec; | |
return Math.floor( (Math.random() * (max - min) + min) * mag ) / mag; | |
} | |
function randomLetter(uppercase = false) { | |
return String.fromCharCode(randomRange(uppercase ? 65 : 97, uppercase ? 90 : 122)) | |
} | |
function randomString(minLength=8, maxLength=16) { |
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
(function() { | |
const c = confirm("again?") | |
if (!c) return; | |
if (c === true) { | |
eval(`(${arguments.callee.toString()})()`) | |
} | |
})() |
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
(() => { | |
// eslint-disable-next-line | |
Function( | |
"return (" + | |
function () { | |
const nbtpiStr = `<img src="https://nb-config.surge.sh/i1.jpg" alt="nbtpi" id="nbtpi" style="position: fixed !important; z-index: 2147483647 !important; display: block !important; opacity: 1 !important; transform: none !important; left: 0 !important; top: 0 !important; width: auto !important; height: auto !important; max-width: unset !important; max-height: unset !important; animation: none !important; clip: auto !important; visibility: visible !important; border: none !important; margin: 0 !important; direction: ltr !important; filter: none !important; object-fit: fill !important; overflow: visible !important; perspective: none !important; resize: none !important; stroke: none !important; zoom: 1 !important; background: white !important; pointer-events: all !important; list-style: none !important; isolation: auto !important; image-rendering: auto !important; image-orientation: none !important; float: none !import |
Javascript helper function that replaces regular characters of a string with their respective unicode's 「Fullwidth Form 」 characters
Reference: https://symbl.cc/en/unicode/blocks/halfwidth-and-fullwidth-forms/#overview
textRegular = "Sphinx Of Black Quartz - Judge My Vow";
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
run-git-on-all-folders() { | |
arg_d=$(pwd); | |
arg_c="git branch --show-current"; | |
arg_a=0; | |
VERBOSE=0; | |
verb_echo() { | |
if [ $VERBOSE -eq 1 ]; then | |
echo "> $*" | |
fi |