Skip to content

Instantly share code, notes, and snippets.

View kt3k's full-sized avatar

Yoshiya Hinosawa kt3k

View GitHub Profile
@kt3k
kt3k / test.md
Last active August 23, 2023 11:47

$1

$1$

$$1$$

  graph TD;
      A-->B;
 A-->C;
ACL [RFC3744, Section 8.1]
BASELINE-CONTROL [RFC3253, Section 12.6]
BIND [RFC5842, Section 4]
CHECKIN [RFC3253, Section 4.4, Section 9.4]
CHECKOUT [RFC3253, Section 4.3, Section 8.8]
CONNECT [RFC9110, Section 9.3.6]
COPY [RFC4918, Section 9.8]
DELETE [RFC9110, Section 9.3.5]
GET [RFC9110, Section 9.3.1]
HEAD [RFC9110, Section 9.3.2]
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
title String
import {
iterateReader,
readableStreamFromIterable,
} from "https://deno.land/std@0.158.0/streams/mod.ts";
import { createHash } from "https://deno.land/std@0.158.0/hash/mod.ts";
const path = "data.txt";
function toHex(digest: ArrayBuffer) {
return [...new Uint8Array(digest)].map(x => x.toString(16).padStart(2, '0')).join('')
@kt3k
kt3k / main.ts
Created September 5, 2022 12:55
import { serve } from "https://raw.githubusercontent.com/denoland/deno_std/main/http/server.ts";
import "https://raw.githubusercontent.com/denoland/deno_std/main/node/module_all.ts";
serve(() => new Reseponse("ok"));
/** @jsx h */
import { bind, h } from "https://deno.land/x/kt3klib@v0.0.3/paul.ts";
bind("my-component", ({ on, morph }) => {
let count = 0;
on("click", "button", () => {
count++;
render();
});
/** @jsx h */
import { bind, cl, h } from "https://deno.land/x/kt3klib@v0.0.3/paul.ts";
import { Todo, TodoCollection } from "./todo-models";
type Filter = "all" | "completed" | "uncompleted";
type Query = <T = HTMLElement>(q: string) => T | null;
const hashToFilter = {
"#/all": "all",
"#/active": "uncompleted",
"#/completed": "completed",
@kt3k
kt3k / rds.ts
Last active June 27, 2022 05:15
import { ApiFactory } from "https://deno.land/x/aws_api@v0.6.0/client/mod.ts";
import { RDSDataService } from "https://aws-api.deno.dev/v0.3/services/rdsdataservice.ts";
const rds = new ApiFactory({ region: "us-west-2" }).makeNew(RDSDataService);
const resp = await rds.executeStatement({
resourceArn: "arn:aws:rds:<region>:<account number>:<resourcetype>:<name>",
secretArn: "arn:aws:secretsmanager:<region>:<account number>:secret:<name>",
sql: "SELECT * FROM users LIMIT 10",
});
console.log(resp.records);
async function checkModuleSupport(name) {
try {
await import(name);
console.log(`✅ ${name} is supported`);
} catch {
console.log(`❌ ${name} is not supported`);
}
}
for (const mod of [