Skip to content

Instantly share code, notes, and snippets.

View xzec's full-sized avatar

Juraj Žec xzec

View GitHub Profile
@xzec
xzec / asyncHandler.ts
Created December 3, 2023 19:10
Express.js asyncHandler + typing
import {
type NextFunction,
type Request,
type RequestHandler,
type Response,
} from 'express'
export const asyncHandler =
(
fun: (req: Request, res: Response, next: NextFunction) => Promise<void>,
const input = await Deno.readTextFile('input.txt')
const lines = input.split('\n')
type Direction = 'L' | 'U' | 'R' | 'D'
type Movement = [Direction, number]
type Vector2D = [x: number, y: number]
type Rope = Vector2D[]
const ROPE_LENGTH = 10