1import { email } from "https://esm.town/v/std/email?v=9";
2
3export default async function(interval: Interval) {
4 const ntfyURL = `https://ntfy.sh/${Deno.env.get("NTFY_ID")}`;
5 const hnTopStoriesURL = "https://hacker-news.firebaseio.com/v0/topstories.json";
3import { useEffect, useRef } from "https://esm.sh/hono/jsx/dom";
4
5export function BlobEditor(props: { blob: { language?: string; text: string } }) {
6 const ref = useRef();
7 const saveBlob = async () => {
43}
44
45export function blobEditor(key: string, options?: { title?: string }) {
46 return async (req: Request) => {
47 const { html } = await import("https://esm.town/v/pomdtr/gfm");
53 const { extractValInfo } = await import("https://esm.town/v/pomdtr/extractValInfo");
54
55 async function readBlob(key: string) {
56 const resp = await blob.get(key);
57 if (resp.status == 200) {
162}
163
164export default async function(req: Request) {
165 const { modifyFetchHandler } = await import("https://esm.town/v/andreterron/codeOnValTown?v=50");
166 return modifyFetchHandler(blobEditor("blob_editor_demo.md"))(req);
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return punchline;
5export const inDir = (directory: string) => (blobMeta: BlobMetadata) => blobMeta => dirname(blobMeta.key) === directory;
6
7export async function blobDirList(directory: string) {
8 const list = await blob.list(directory);
9 return list.filter(inDir(directory));
9};
10
11export function authMiddleware(
12 handler: (Request) => Promise<Response>,
13 options: Options,
56}
57
58export default async function(req: Request): Promise<Response> {
59 return new Response("This is middleware only");
60}
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2
3export default async function() {
4 discordWebhook({
5 url: Deno.env.get("engDiscord"), // TODO replace this with the #office channel
1export default async function(interval) {
2 // Sample phrases and words that are likely to appear in dream descriptions
3 const introPhrases = [
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "Atlanta";
6
1export function insecureFetch(input: string | URL | Request, init?: RequestInit) {
2 const origReq = new Request(input, init);
3 const proxyURL = new URL("https://unsecure-fetch.val-town.workers.dev");
4
5const openai = new OpenAI();
6const functionExpression = await openai.chat.completions.create({
7 "messages": [
8 { "role": "user", "content": "Say hello in a creative way" },
12});
13
14console.log(functionExpression.choices[0].message.content);
Simple functional CSS library for Val Town
A helper function to build a file's email
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.