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
125]
126
127async function uploadImage(imageBuffer: any, altText: string): Promise<string> {
128 const formData = new FormData();
129 formData.append("file", new Blob([imageBuffer], { type: "image/png" }));
146}
147
148async function postStatusWithImage(statusText: string, imageBuffer: any, altText: string) {
149 const mediaId = await uploadImage(imageBuffer, altText);
150
170}
171
172async function overlayTextOnImage(slammer_text: string, slammed_text: string, imageDef: Image): Promise<Uint8Array> {
173 const image = await loadImage(imageDef.url);
174 let fontFile = await fetch(
208}
209
210export default async function generateOneMastodonPost(request: Request): Promise<Response> {
211 const inputs = (await blob.list(BLOB_PREFIX))
212 if (inputs.length == 0) {
1import { BskyAgent, BlobRef, RichText } from 'npm:@atproto/api';
2
3export async function blueskyPostWithImage(statusText: string, imageBuffer: any, altText: string) {
4 const BSKY_EMAIL = Deno.env.get("BSKY_EMAIL");
5 const BSKY_PWD = Deno.env.get("BSKY_PWD");
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [file, setFile] = useState(null);
7 const [fileName, setFileName] = useState("");
131}
132
133function client() {
134 const root = document.getElementById("root");
135 if (root) {
142}
143
144export default async function server(request: Request): Promise<Response> {
145 return new Response(
146 `
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [file, setFile] = useState(null);
7 const [fileName, setFileName] = useState("");
131}
132
133function client() {
134 const root = document.getElementById("root");
135 if (root) {
142}
143
144export default async function server(request: Request): Promise<Response> {
145 return new Response(
146 `
1export default async function (req: Request): Promise<Response> {
2 if (req.method !== 'POST') {
3 return new Response('Please send a POST request with a file', { status: 405 });
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.pathname.slice(1); // Remove leading slash
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.pathname;
1export default async function(req: Request): Promise<Response> {
2 const now = new Date();
3 const hours = now.getHours().toString().padStart(2, "0");
12}
13
14function generateTimeAsciiArt(time: string): string {
15 const digits = {
16 "0": [
1export default async function (req: Request): Promise<Response> {
2 const asciiArt = `
3 _ _ _ _ __ __ _ _ _
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.