8// Fetches a random joke.
9// Fetches a random joke.
10async function fetchRandomJoke() {
11 const response = await fetch(
12 "https://official-joke-api.appspot.com/random_joke",
1049console.log("solution *2:", secondStar(input));
1050
1051function debug<T>(value: T, msg = "debug"): T {
1052 console.log(msg, value);
1053 return value;
32console.log(text);
33
34export async function weatherGPT() {
35 await email({ subject: "Weather Today", text });
36}
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
1This is a great template if you want to solve the <https://adventofcode.com> puzzles in a TDD style:
21. dump your puzzle input into the `input` function
32. copy/paste sample input and output from the page
43. once all assertions pass, the solution is calculated
5
6There is one function for each star that can be achieved.
7
8Some helpers for common tasks are defined at the end of code: `debug`, `toInt`, `exctractNumbers`, `sum`, ... ?
4};
5
6function parse(str: string) {
7 var i = 0;
8 var parts = [];
55 .slice(i + 2, closing)
56 .replace(regex[quote], quote)
57 .replace(/\\+/g, function(backslash) {
58 return new Array(Math.ceil(backslash.length / 2) + 1).join("\\");
59 }),
68}
69
70function degron(txt: string) {
71 const lines = txt.trim().split("\n");
72 const initializer = lines.shift()?.split(" = ")[1]; // initializer line
104)[];
105
106function materializeNameStack(nameStack: NameStack) {
107 return nameStack
108 .map((x) => {
119}
120
121function gron(json: any) {
122 const lines = [];
123
1export const str = "hello world";
2
3export default function handler(request: Request) {
4 return Response.json({ ok: true });
5}
4};
5
6function fetchRandomJoke() {
7 const SAMPLE_JOKE = {
8 "setup": "What is the best way to explore Italy?",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
3import { resume as resume2 } from "https://esm.town/v/ajax/resume";
4
5export async function annoy() {
6 const resume = resume2;
7 // const boo = await import("https://esm.sh/@atproto/api");
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": "*",