- 公式 doc 的には
.tz()の場合はdayjs.tz.setDefault(tz)が使われている場合、その tz で初期化されるとある - Date を渡した場合は挙動に差は無さそう
- string を渡す場合は timezone 以前に
dayjs.tz()の結果がおかしな挙動になる
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 { newWebSocketRpcSession } from "capnweb"; | |
| import type { MyApi } from "./server.ts"; | |
| const api = newWebSocketRpcSession<MyApi>("ws://localhost:8080/api"); | |
| const result = await api.hello("World"); | |
| console.log(result); |
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
| services: | |
| db: | |
| image: mysql:8.0 | |
| command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_bin | |
| environment: | |
| - MYSQL_ALLOW_EMPTY_PASSWORD=yes | |
| - MYSQL_DATABASE=app_development | |
| ports: | |
| - "3306:3306" |
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 { Suspense, use } from 'react'; | |
| function Messages({ fetchMessages }: { fetchMessages: Promise<string[]> }) { | |
| // Promise must be initialized outside the component currently. | |
| // see: https://react.dev/blog/2024/12/05/react-19#new-feature-use | |
| // | |
| // This doesn't work; | |
| // ``` | |
| // const messages = use(new Promise<string[]>((resolve) => { | |
| // setTimeout(() => { |
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
| /** | |
| * @example | |
| * ```ts | |
| * const POST_STATE = { | |
| * DRAFT: 0, | |
| * PUBLISHED: 1, | |
| * // ... | |
| * } as const; | |
| * type PostState = (typeof POST_STATE)[keyof typeof POST_STATE]; | |
| * |
express.js official migration guide is not sufficient yet.
- Check manually in your RequestHandler
- Be careful declaration order
// users.router.ts
import { Router } from "express";
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 { assertEquals } from "jsr:@std/assert"; | |
| import { paginate } from "./pagination.ts"; | |
| Deno.test(function paginateTest() { | |
| assertEquals(paginate(1, 1), [1]); | |
| assertEquals(paginate(1, 2), [1, 2]); | |
| assertEquals(paginate(2, 2), [1, 2]); |
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
| #!/bin/bash | |
| function print_multiline() { | |
| local text=$(cat <<'EOF' | |
| ``` | |
| # Markdown Text | |
| - one | |
| - two | |
| ``` |
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
| /** | |
| * ref: https://www.freecodecamp.org/news/javascript-range-create-an-array-of-numbers-with-the-from-method/ | |
| * | |
| * # Example | |
| * | |
| * ```ts | |
| * import { range } from "./main.ts"; | |
| * | |
| * range(1, 5); | |
| * // [1, 2, 3, 4, 5] |
NewerOlder