Skip to content

Instantly share code, notes, and snippets.

pub trait ToJson {
write_json_string(Self, Buffer) -> Unit
}
fn ToJson::write_json_string(self : Int, buf : Buffer) -> Unit {
buf.write_string(self.to_string())
}
fn ToJson::write_json_string(self : Bool, buf : Buffer) -> Unit {
buf.write_string(self.to_string())

String JS <=> Moonbit

struct MyCtx {
  result: String
  mut cur: Int
  input: @vec.Vec[Int]
}

pub fn app() -> MyCtx {
@mizchi
mizchi / one-button-playing.md
Last active March 20, 2024 11:37
ヴァンサバに至るローグライクとハクスラの歴史

これはポ鯖アドベントカレンダーの1日目の記事。

ヴァンサバはいとこ同士の子だという話をするために、ハクスラとローグライトの話をしたい。

本記事は身内の友人向けの記事なので、主観が強く、記事の正確性は重要視していない。それについてはご勘弁願いたい。


では、話をしよう。

@mizchi
mizchi / agent.test.ts
Created March 19, 2024 07:57
軽量 Langchain 的な何か
import { defineAgent, ok, err, runAgent, stepAgent, chain, initAgent } from "./agent.ts";
import { Agent, AgentError, AgentErrorCode } from "./types.ts";
import { expect } from "https://deno.land/std@0.214.0/expect/mod.ts";
Deno.test("stepAgent: simple", async () => {
const simple = defineAgent((_init) => {
return {
async invoke(input, _options) {
return `Hello, ${input}`;
},
// prompt can not catch ctrl-c
const ret = prompt('input>');
console.log(ret); // SIGINT interrupt before this line
// returns null with ctrl-c if signal handler is registerred.
function getInput(message: string): string | null {
const handler = () => {};
Deno.addSignalListener('SIGINT', handler);
const ret = prompt(message);
Deno.removeSignalListener('SIGINT', handler);
@mizchi
mizchi / unitest.mjs
Created February 2, 2024 18:02
universal-test helper
/*
Universal testing library for Deno, Node.js, Vitest and the browser.
// foo.test.{js,mjs,ts}
import { test, eq } from './unitest.mjs';
test('1 === 1', () => {
eq(1, 1);
});
$ deno test foo.test.ts

タロンで3/4/5で勝利した試合の反省。

https://www.op.gg/summoners/jp/mizchi2-JP1

正直対面には負けた試合だったがマクロの判断でいくつか勝って、学びが多い回だった。

うろ覚えで書いているので、動画見ながら読むといくつか齟齬があるかも。


theme marp
gaia
true

Qwik それはフロントエンドの見た夢 Long Version

@mizchi | PWA Night