2import { createClient } from "npm:@libsql/client";
3
4export function createTursoProxy(databaseUrl: string, authToken: string) {
5 const client = createClient({
6 url: `${databaseUrl}?authToken=${Deno.env.get("TURSO_AUTH_TOKEN")}`,
37// });
38
39function parseResultSet<T>(row: ResultSet): T[] {
40 return row.rows.map((r) => Object.fromEntries(r.map((c, i) => [row.columns[i], c]))) as T[];
41}
51};
52
53function diffCircles(array1: Circle[], array2: Circle[]): Circle[] {
54 const changes: Circle[] = [];
55
74
75 const drag = (() => {
76 function dragstarted() {
77 d3.select(this).attr("stroke", "black");
78 }
79
80 function dragged(event, d) {
81 d3.select(this).raise().attr("cx", d.x = event.x).attr("cy", d.y = event.y);
82 }
83
84 function dragended() {
85 const x = d3.select(this).attr("cx");
86 const y = d3.select(this).attr("cy");
105 .call(drag)
106 .on("click", clicked);
107 function clicked(event, d) {
108 if (event.defaultPrevented) return; // dragged
109
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(
6let linkClass = "text-sky-600 hover:text-sky-500";
7
8export default function FAQ(c) {
9 return c.html(
10 <Layout activeTab={new URL(c.req.url).pathname}>
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
1const msg = new TextEncoder().encode("💩");
2const initialDelay = 20;
3export default async function(req: Request): Promise<Response> {
4 let timerId: number | undefined;
5 const body = new ReadableStream({
6 start(controller) {
7 let currentDelay = initialDelay;
8 function writeToStream() {
9 currentDelay *= 1.03;
10 controller.enqueue(msg);
7
8const tabs = { "/": "Home", "/browse": "Browse", "/faq": "FAQ" };
9export default function() {
10 const navigation = useNavigation();
11 return (
1const msg = new TextEncoder().encode("💩");
2const delay = 10;
3export default async function(req: Request): Promise<Response> {
4 let timerId: number | undefined;
5 const body = new ReadableStream({
3const DISCORD_WEBHOOK = Deno.env.get("DISCORD_TANAKI_WEBHOOK");
4
5export default async function(interval: Interval) {
6 const supabase = createClient(
7 Deno.env.get("TANAKI_SUPABASE_URL"),
1# MAD BOTS (Multi-functional Alerting & Diagnostics Bot Operations Tracking System)
2
3This val runs every two minutes and makes sure a supabase realtime websocket listener is still alive.
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",