1import ky from "npm:ky";
2
3export async function shortenURL(url: URL | string) {
4 const json = {
5 domain: "dub.sh",
37};
38
39async function execute(statement: InStatement): Promise<ResultSet> {
40 return ky.post("execute", {
41 json: { statement },
44}
45
46async function batch(statements: InStatement[]): Promise<ResultSet[]> {
47 return ky.post("batch", {
48 json: { statements },
10const dumped = {};
11
12async function database() {
13 const dump = await sqliteDump(dumped);
14 const sqlite = createSqlite();
22};
23
24async function execute(statement: InStatement): Promise<ResultSet> {
25 const res = await fetch(`${ENDPOINT}/execute`, {
26 method: "POST",
33}
34
35async function batch(statements: InStatement[]): Promise<ResultSet[]> {
36 const res = await fetch(`${ENDPOINT}/batch`, {
37 method: "POST",
6} from "https://esm.town/v/postpostscript/valTownLogo";
7
8export default async function(req: Request): Promise<Response> {
9 const html = `
10 <html>
1export async function html(markdown: string) {
2 const [
3 { micromark },
15}
16
17export async function gfm(
18 markdown: string,
19 options?: {
24const BADGE_COLOR = "6855c3";
25
26export default async function(req: Request): Promise<Response> {
27 const reqURL = new URL(req.url);
28 if (reqURL.pathname === "/") {
54}
55
56async function getBadgeConfig(aspeUri: string, debug = false): Promise<BadgeConfig> {
57 const config: BadgeConfig = {
58 label: BADGE_LABEL,
77}
78
79async function processAspeUri(aspeUri: string) {
80 let aspeURI: AspeURI | LegacyAspeURI = parseAspeURI(aspeUri);
81 if (!aspeURI) {
1// SPDX-License-Identifier: 0BSD
2
3export function appendFragment(fragment: string, html: string) {
4 if (!fragment) return html;
5 let offset = Math.min(
4import { isSameDay } from "npm:date-fns";
5
6export default async function checkTodayWorkout() {
7 const data = await fetchPelotonWorkouts(
8 "3f5bf759bb65494d8b35d26ec72b7340",
5const KEY = import.meta.url.split("?")[0];
6
7export async function addComment(str) {
8 const comments = await blob.getJSON(KEY) as Array<string> ?? [];
9 comments.push(str);
11 await email({ text: "New Comment Alert!: " + str });
12}
13export async function getComments() {
14 return await blob.getJSON(KEY) as Array<string> ?? [];
15}
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "brooklyn navy yard"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
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.