[Optional] Uninstall Docker Desktop
- Start Docker Desktop
- Remove all docker resources (e.g.,
docker container prune
) - Stop Docker Desktop
rm -rf ~/.docker
Install Docker in WSL2
// see https://deno.land/std/datetime/constants.ts?source | |
const MILLISECOND = 1; | |
const SECOND = MILLISECOND * 1e3; | |
const MINUTE = SECOND * 60; | |
const HOUR = MINUTE * 60; | |
const DAY = HOUR * 24; | |
const WEEK = DAY * 7; | |
type Unit = | |
| "milliseconds" |
https://pnpm.io/installation#using-corepack
$ corepack enable
$ corepack prepare pnpm@latest --activate
$ pnpm --version
// https://www.typescriptlang.org/play#example/nominal-typing | |
type ValidatedInputString = string & { __brand: "User Input Post Validation" }; | |
// https://speakerdeck.com/naoya/typescript-niyoru-graphql-batukuendokai-fa-75b3dab7-90a8-4169-a4dc-d1e7410b9dbd?slide=91 | |
declare const __newtype: unique symbol; | |
export type newtype<Constructor, Type> = Type & { |
// see: https://www.bbss.dev/posts/eventloop/ | |
/** | |
* @example | |
* ```ts | |
* const fn = makePromise(() => { | |
* return heavyFunc(); | |
* }); | |
* // or you can write: | |
* // const fn = makePromise(heavyFunc); |
ref: https://stackoverflow.com/a/62885391
Run test with the following command:
node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage
--expose-gc
is V8 options (see node --v8-options
)--logHeapUsage
: https://jestjs.io/docs/cli#--logheapusagemysql> SELECT * FROM information_schema.SCHEMATA WHERE schema_name = "test"; | |
+--------------+-------------+----------------------------+------------------------+----------+ | |
| CATALOG_NAME | SCHEMA_NAME | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | | |
+--------------+-------------+----------------------------+------------------------+----------+ | |
| def | test | latin1 | latin1_swedish_ci | NULL | | |
+--------------+-------------+----------------------------+------------------------+----------+ | |
1 row in set (0.00 sec) | |
-- https://stackoverflow.com/a/6115705 | |
mysql> ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern | |
# maybe settings are like the following: | |
- OriginSettings: | |
- OriginDomain: MY-EXAMPLE-BUCKET.s3.ap-northeast-1.amazonaws.com | |
OriginPath: /static | |
- OriginDomain: example-load-balancer-1234567890.ap-northeast-1.alb.amazonaws.com | |
OriginPath: * |
// Suppose we have following code: | |
class APIError extends Error {} | |
function throwAPIError(message: string) { | |
// complicated logic... | |
throw new APIError(message); | |
} |
// Chapter 6 | |
type NonEmptyArray<T> = [T, ...T[]]; |