Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const util = require('util');
const glob = require('glob');
// UTILS
// join :: string -> [string] -> string
const join = (glue: string) => (xs: string[]): string => xs.join(glue);
// concatString :: string -> string -> string
@YuraKostin
YuraKostin / timeoutChain.js
Created December 13, 2021 06:51
timeoutChain
const timeoutChain = (fn, { ms } = { ms: 0 }) => {
const timer = {
id: null,
unsubscribe(done = () => {}) {
clearTimeout(this.id);
this.isRunning = false;
done();
},
isRunning: true,
};
@YuraKostin
YuraKostin / first.ts
Last active December 30, 2020 13:10
First using of fp-ts
import {fold, Monoid} from "fp-ts/Monoid";
const enum EventProperties {
eventLabel = 'eventLabel',
eventContext = 'eventContext',
eventContent = 'eventContent',
eventLocation = 'eventLocation'
}
type EventAttributes = {
@YuraKostin
YuraKostin / error
Last active October 23, 2020 11:16
Will Kurt. Lesson 10
robots.hs:47:36: error:
• Couldn't match type ‘[Char]’
with ‘((a1, b1, [Char]) -> t1) -> t1’
Expected type: ((a1, b1, [Char]) -> ((a1, b1, [Char]) -> t1) -> t1)
-> ((((a1, b1, [Char]) -> t1) -> t1, b1,
((a1, b1, [Char]) -> t1) -> t1)
-> ((a1, b1, [Char]) -> t1) -> t1)
-> [Char]
Actual type: ((((a1, b1, [Char]) -> t1) -> t1, b1,
((a1, b1, [Char]) -> t1) -> t1)