flowchart LR
a((a)) --> b((a))
classDef default stroke:#333,stroke-width:2px
This file contains hidden or 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
{-# LANGUAGE NoImplicitPrelude #-} | |
import Data.Bool (Bool, (&&), (||)) | |
import Numeric.Natural (Natural) | |
import Prelude (Int, (+), (-)) | |
{- | | |
마그마(Magma)는 집합과 '닫힌' 이항 연산자 (이항 연산의 결과가 집합에 속함) | |
(𝕄, •) ⊢ ∀ a, b ∈ 𝕄 ⟹ a • b ∈ 𝕄. |
This file contains hidden or 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 * as dotenv from "https://deno.land/[email protected]/dotenv/mod.ts" | |
import { basename } from "https://deno.land/[email protected]/path/mod.ts" | |
import { Command } from "https://deno.land/x/[email protected]/command/mod.ts" | |
import { z } from "https://deno.land/x/[email protected]/mod.ts" | |
import { asynciter } from "https://deno.land/x/[email protected]/mod.ts" | |
import { difference } from "https://deno.land/x/[email protected]/mod.ts" | |
import { match, P } from "npm:ts-pattern@^5.0.3" | |
const cookieKey = "AOC_SESSION" | |
const cookieSchema = z.string().min(1, "Session cannot be empty!") |
This file contains hidden or 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 { initContract, ServerInferResponseBody, ServerInferResponses } from "npm:@ts-rest/core" | |
import z, { boolean } from "npm:zod" | |
import { createExpressEndpoints, initServer } from "npm:@ts-rest/express" | |
// @deno-types=npm:@types/express | |
import express from "npm:express" | |
const dataSchema = z.object({ data: z.boolean().default(false) }) | |
type DataInfer = z.infer<typeof dataSchema> | |
type DataInput = z.input<typeof dataSchema> |
This file contains hidden or 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
#!/usr/bin/env -S deno run --allow-run --allow-read --no-config --no-check --no-npm | |
import clipboard from "https://deno.land/x/[email protected]/mod.ts" | |
import { readAll } from "https://deno.land/[email protected]/streams/mod.ts" | |
const filename = Deno.args[0] | |
if (filename) { | |
const text = await Deno.readTextFile(filename) | |
await clipboard.writeText(text) | |
} else if (!Deno.isatty(Deno.stdin.rid)) { |
This file contains hidden or 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
#!/usr/bin/env bash | |
readonly GREEN='\033[32m' | |
readonly NC='\033[0m' | |
header() { printf "${GREEN}$@${NC}"; } | |
readonly LOCATION=$(pwd)/bash-in-a-jar | |
header "installation location:\n" | |
echo ${LOCATION} |
This file contains hidden or 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
export const mapEntries = <T, U>( | |
obj: Record<string, T>, | |
fn: (entry: [string, T]) => [string, U], | |
) => Object.fromEntries(Object.entries(obj).map(fn)) |
This file contains hidden or 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 getUrl = (elem: Element) => elem.getAttribute("href")!.split("?")[0] | |
const setQuery = (selector: string, query: string) => () => { | |
const elem = document.querySelector(selector) | |
if (!elem) { | |
console.log(`elem with ${selector} not found`) | |
return | |
} | |
const newSearchParams = new URLSearchParams({ q: query }) | |
elem.setAttribute("href", `${getUrl(elem)}?${newSearchParams}`) |
테스트 환경
This file contains hidden or 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
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-run --allow-env --unstable | |
import { Command } from "https://deno.land/x/[email protected]/command/mod.ts" | |
import { dirname, join } from "https://deno.land/[email protected]/path/mod.ts" | |
import { c, p } from "https://deno.land/x/[email protected]/mod.ts" | |
const mapKeys = | |
<A>(f: (k: string) => string) => (record: Readonly<Record<string, A>>): Record<string, A> => | |
Object.fromEntries(Object.entries(record).map(([k, v]) => [f(k), v])) |