Skip to content

Instantly share code, notes, and snippets.

View svaqqosov's full-sized avatar

Sardor Vaqqosov svaqqosov

View GitHub Profile
const words = '일이삼사오육칠팔구십백천만억조';
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 1000, 10000, 100000000, 1000000000000];
const nmap = {};
const wmap = {};
// eslint-disable-next-line no-plusplus
for (let i = 0; i < numbers.length; i++) {
nmap[words[i]] = numbers[i];
wmap[numbers[i]] = words[i];
}
@svaqqosov
svaqqosov / Add two big integers
Created December 14, 2019 14:22
Gets two big integers as argument and outputs their sum.
const add = (args) => {
let [a, b] = args;
let len = 0;
// Get longer string and assign it to len
if (a.length > b.length) {
len = a.length;
// pad string b with leeding zeros
b = b.padStart(len, '0');
} else {
len = b.length;
@svaqqosov
svaqqosov / Pre commit hook for running local ESlint before each commit
Last active March 21, 2018 07:27
Create file in .git/hooks/ folder with a name 'pre-commit'. Give execution permission to the file: chmod +x pre-commit
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true

Keybase proof

I hereby claim:

  • I am svaqqosov on github.
  • I am svaqqosov (https://keybase.io/svaqqosov) on keybase.
  • I have a public key ASC_9b96p4346JGuEyibP8Cp5Sn9eDal0n-UqcCLiko82Qo

To claim this, I am signing this object: