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
Set UP Eslint + Prettier in VSCode | |
// Docs (JS only) - https://github.com/wesbos/eslint-config-wesbos | |
// Anoter docs (TS and JSX) - https://github.com/sarpik/eslint-config-sarpik | |
https://gist.github.com/okovalov/aaf8bc5d05b59caa98eeec5e89612bd3 | |
1. Create react app | |
npx create-react-app react-ts --template typescript |
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 username = '' | |
const password = '' | |
const token = Buffer.from(`${username}:${password}`, 'utf8').toString('base64') | |
const url = 'https://...' | |
axios.post(url, { | |
headers: { | |
'Authorization': `Basic ${token}` |
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
#!/usr/bin/env node | |
// .eslintrc.js | |
/** | |
* The ESLint + Prettier config from Kipras <[email protected]> (https://kipras.org) | |
* | |
* Supports TypeScript! | |
* ( | |
* https://javascriptplayground.com/typescript-eslint/ | |
* & https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project |
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
#!/usr/bin/env node | |
console.log('yay gist') |
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
#!/usr/bin/env node | |
console.log('v6', process.argv, process.cwd(), __dirname); | |
const {exec} = require('child_process'); | |
const path = require('path'); | |
exec('npm bin', {cwd: __dirname}, (err, stdout, stderr) => { | |
if (err) { | |
console.error(err); | |
} else { |
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
I think above can be simplified using following commands. | |
git submodule deinit <path_to_submodule> | |
git rm <path_to_submodule> | |
git commit-m "Removed submodule " | |
rm -rf .git/modules/<path_to_submodule> | |
taken from https://gist.github.com/myusuf3/7f645819ded92bda6677#gistcomment-3141323 |
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
interface CurrencyKey { | |
keyIndex: number; | |
privateKey: string; | |
publicKey: string; | |
address?: string; | |
getKeyIndex(): number; | |
getPrivateKey(): string; | |
getPublicKey(): string; | |
getAddress(): string; | |
} |
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
body { | |
background-color: aqua; | |
} |
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
// 1. quick convert Number to String | |
const age = 18 + "" | |
console.log(typeof age) // string | |
// 3. fill arrays | |
const users = Array(5).fill('') | |
console.log(users); // [ '', '', '', '', '' ] |
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 name = 'Hi my name is Flavio' | |
name.replace(/\s/g, '') //HimynameisFlavio | |
// https://flaviocopes.com/how-to-replace-whitespace-javascript/ |