This file contains 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
Function.prototype.pipe = function (start, ...funcs) { | |
return funcs.reduce((prev, func) => func(prev), start) | |
} | |
const func01 = (prev) => prev + 1 | |
const func02 = (prev) => prev + 1 | |
const func03 = (prev) => prev + 1 | |
const func04 = (prev) => prev + 1 | |
const func05 = (prev) => prev + 1 |
This file contains 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
CREATE TABLE IF NOT EXISTS artices ( | |
id serial PRIMARY KEY, | |
title VARCHAR (50) NOT NULL, | |
slug VARCHAR (255) NOT NULL, | |
deleted_at TIMESTAMP NULL, | |
created_on TIMESTAMP not NULL DEFAULT NOW() | |
); | |
CREATE UNIQUE INDEX IF NOT EXISTS unique_slug |
This file contains 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 refKeeperMapFactory = (() => { | |
type RefMap = Map<string, Record<string, any>> | |
let refKeeper: RefMap | |
return () => { | |
if (refKeeper) { | |
return refKeeper | |
} | |
const mapProxyHandler = { | |
get(target: RefMap, name: string) { | |
const functionOrValue = Reflect.get(target, name) |
This file contains 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 magicObject = new Proxy( | |
{}, | |
{ | |
get(_, prop) { | |
return new Proxy({ [prop]: 'hmmm?' }, this) | |
}, | |
} | |
) | |
This file contains 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
import PromiseQueue from 'p-queue' | |
import got, { Request } from 'got' | |
import colors from '@jshor/colors' | |
console.clear() | |
let counter = 0 | |
let errorCounter = 0 | |
const { bold, green, red } = colors |
This file contains 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
import axios, { AxiosResponse } from 'axios' | |
type TODO = { | |
userId: number | |
id: number | |
title: string | |
completed: boolean | |
} | |
const DEFAULT_TIMEOUT = 200 |
This file contains 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
import axios, { AxiosResponse } from 'axios' | |
import { v4 as uuidv4 } from 'uuid' | |
export type PromiseStatus<T> = { | |
promise: Promise<T> | |
isFulfilled: boolean | |
isRejected: boolean | |
} |
This file contains 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
create table emojies( | |
name text | |
); | |
INSERT INTO emojies VALUES('๐ป'), ('๐บ'), ('๐น'), ('๐คก'), ('๐๏ธ'), ('๐ธ') | |
select * from emojies | |
JOIN UNNEST(ARRAY['๐ธ', '๐ป', '๐บ', '๐๏ธ', '๐น', '๐คก']) WITH ORDINALITY my_order_table("name", "ordinality_order") USING("name") | |
ORDER BY "ordinality_order" |
OlderNewer