Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Oleksandr Kovalov okovalov

🏠
Working from home
  • Toronto
Block or report user

Report or block okovalov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View playground.json
{
"scripts": [],
"showConsole": true,
"scriptType": "module"
}
View js_Logging_objects.js
//
// Logging objects
//
// Don't use
console.log(obj);
//use
console.log(JSON.parse(JSON.stringify(obj)));
View eslint_prettier_vscode_js_ts_jsx_tsx.txt
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
@okovalov
okovalov / axios_send_auth_token.js
Created Jan 22, 2020
Learn how to send the authorization header using Axios (from https://flaviocopes.com/axios-send-authorization-header/)
View axios_send_auth_token.js
const username = ''
const password = ''
const token = Buffer.from(`${username}:${password}`, 'utf8').toString('base64')
const url = 'https://...'
axios.post(url, {
headers: {
'Authorization': `Basic ${token}`
@okovalov
okovalov / .eslintrc.js
Last active Jan 22, 2020
temporary fork from eslint-config-sarpik
View .eslintrc.js
#!/usr/bin/env node
// .eslintrc.js
/**
* The ESLint + Prettier config from Kipras <kipras@kipras.org> (https://kipras.org)
*
* Supports TypeScript!
* (
* https://javascriptplayground.com/typescript-eslint/
* & https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
@okovalov
okovalov / index.js
Created Jan 22, 2020 — forked from zkat/index.js
npx is cool
View index.js
#!/usr/bin/env node
console.log('yay gist')
View React-PropTypes-to-prop-types.js
#!/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 {
View git_remove_submodule.txt
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
@okovalov
okovalov / index.html
Last active Jan 18, 2020
FlexBox sandbox
View index.html
<html>
<body>
<div class="screen">
<div class="first box">
1
</div>
<div class="second box">
2
</div>
<div class="third box">
@okovalov
okovalov / derive_keypair.ts
Last active Jan 14, 2020
an example of derriving keypairs with factories
View derive_keypair.ts
interface CurrencyKey {
keyIndex: number;
privateKey: string;
publicKey: string;
address?: string;
getKeyIndex(): number;
getPrivateKey(): string;
getPublicKey(): string;
getAddress(): string;
}
You can’t perform that action at this time.