Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
Remote Fullstack Node.js / Frontend React.js

Qwerty (Vítězslav Ackermann Ferko) ackvf

🏡
Remote Fullstack Node.js / Frontend React.js
View GitHub Profile
@ackvf
ackvf / README.md
Last active Aug 5, 2021
Crypto scripts
View README.md

How does it work?

displaying usd ranges

Create new Bookmark

add new bookmark page

@ackvf
ackvf / README.md
Last active Aug 5, 2021
eToro scripts
View README.md

How to use this?

enable balance

Create new Bookmark

add new bookmark page

Edit Bookmark details

@ackvf
ackvf / deep-object-dot-path.ts
Last active Aug 27, 2021
Typescript Toolbelt
View deep-object-dot-path.ts
/*
TS Playground
https://www.typescriptlang.org/play?#code/C4TwDgpgBAKghgSwDYB4YD4oF5ZQgD2AgDsATAZygG0FiAzCAJygH0AxBR84ASSIFsANFAB0Y2g2YAlCNwC6UAPxQZ3KAC4oxCADcmAWABQRo6EhQAIgHtgAWSYBzCCgCCeQiQpRujWg6pymDjwyK7oVADkSCQOwAAWEQoERGSUAAxGUEpQLlRpcplQAPRFUAACwOQAtASQAMbANYyMVsww4NAR1naOEDAArmDRaIioLujoEVAIlMQ2UHDk5AgOxHAARtFQwFbbHVARPn5QAD5a-fzrTKdQ6yu0wDfrVlbRcMQRIoWaAAYAJABvXL5AC+IkB3XsjCcI1C43QIJ+JkMZmgMDSAEZsJYbFCYZE4Il0KZ9uiAEzYyG9FAEiLCCLrIkk8zogDMlNx1Np9MZ9LqdIOpCZxhFqJxwAAykMEMA0EFcMlPJR-gCJNcXGDAWrmAAhRGFZRUFzCMQibpSpAylA69AFQxZTRUGB25lotIAFg5kulsoihOJKNJaQArF6LVa-SJGQGxeiAGxhn0oSPrER1ERCgPIkpQKp5-MFwtF4sl0tl8sVytVivIowPJh0OB1aAAeXWACsoADCnBNN37VkoPhNEdiA5ClkQH2J4OAF4j4C+MczkGFVcD9bTgdZfqaZ6vCDvNeFOqaYgXK6MIzr5FilzEEBt9sQBrYmR1VqkFCjhzCd4gLNA3MboACkrFoVx3BSLwf2EHUoKVbxFz8eU3EVVIDimZR4N+QENXBAE9SRUV9gABV8fgZQQPQAGkIBAcgUBbBCMPvR8OxfYB5X7LIqBo6ZiCgABreirDoKAWzkTQWz4pIPFYh8n047JtD0ZhNBo68qBEkAxIkl0gOgCwIAgMA6IYpiWK8NilIabjCj4gThNE8TJOk2SrMoGyONfZR+LPXQDEMEFtJc-TbzI-icHIhBKOAaiIHMxin0wHMACI6jS11LCiywTLM+jko7V
View CommService.ts
import CoreAPIService from './CoreAPIService';
import { CommentInterface } from '../interfaces/requestInterface';
class CommService {
// CREATE
addCommentToRequest = async (requestId: number, data: FormData) =>
CoreAPIService.post(`comments/${requestId}`, data, { 'Content-Type': 'multipart/form-data' })
.then<CommentInterface>(response => response.data);
View compose-functions.ts
/**
* @name compose
* @summary Composes Higher-Order-Functions from right to left so that they are executed from left to right.
* note: To compose Higher-Order-Components, use compose.ts
*
*
* @description
* Two overloads are available:
* A) Matches the composed signature of whole compose to the wrapped function.
* B) As an escape hatch, it is possible to explicitly define the resulting OuterSignature with a generic, ignoring the HOFs types.
@ackvf
ackvf / eventloop.js
Last active Nov 14, 2019
Understanding the Event Loop
View eventloop.js
function callback(arg) {
setTimeout(console.log, 0, arg, ' # 4 timeout ');
setImmediate(console.log, arg, ' # 5 immediate');
process.nextTick(console.log, arg, ' # 2 nextTick ');
(async () => { await undefined; console.log(arg, ' # 3 await '); })();
console.log(arg, '# 1 sync ');
}
setTimeout(callback, 0, ' # 4 timeout ');
setImmediate(callback, ' # 5 immediate');
View _typescriptCompatibilityTable.ts
// Type compatibility table
// https://github.com/earshinov/typescript-type-compatibility-table/blob/master/type-compatibility-table.ts
function fx(): never { throw Error("Never returns"); }
function fv(): void { }
var x: never = fx();
var u: undefined = undefined;
var v: void = fv();
var n: null = null;
@ackvf
ackvf / index.tsx
Last active Mar 2, 2021
React TypeScript types
View index.tsx
/* Type guards */
export function assertType<T>(obj: any, assertion: (obj: T) => boolean): asserts obj is T {
if (!assertion(obj)) throw new Error('Invalid type')
}
export function is<T>(obj: any, assertion: (obj: T) => boolean): obj is T {
return assertion(obj);
}
@ackvf
ackvf / functionArgumentsType.ts
Created Mar 12, 2019
Extracting Arguments type of an abstract action executor method
View functionArgumentsType.ts
// Class-based Tree Shaking - HTTP203 @ Google Chrome Developers
// https://www.youtube.com/watch?v=lsd2-TCgHEs&t=599
class Store {
/**
* Do the given action with the given parameters.
*
* @param {A => R} action Action to be taken.
* @param {A} args Arguments to be passed to the action.
* @returns {R} Returns the result of original action call.