14
15// adapted from https://www.val.town/v/pomdtr/extractValInfo
16export function parseVal(url: string | URL): Val {
17 const { pathname, search } = new URL(url);
18 const [username, filename] = pathname.split("/").slice(-2);
12const valtown = new ValTown();
13
14export default async function GitHubPush(c: Context) {
15 // auth check in /index
16 const user = await valtown.me.profile.retrieve();
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;
4import type { Context } from "npm:hono";
5
6export default async function(c: Context) {
7 return c.html(
8 <html>
7}
8
9export function extractProjectValInfo(url: string): ProjectInfo {
10 const pattern = /^https:\/\/esm\.town\/v\/([^/]+)\/([^@]+)@(\d+)-(.+?)(\/.*)?$/;
11 const match = url.match(pattern);
41);
42
43export default async function(req: Request): Promise<Response> {
44 const path = new URL(req.url).pathname;
45 let transport: SSEServerTransport;
3import { handleApiRequest } from 'https://esm.town/v/@username/NeuralCanvas/api';
4
5export default async function server(request: Request): Promise<Response> {
6 const url = new URL(request.url);
7
2import { getWeather } from "https://esm.town/v/stevekrouse/getWeather?v=2";
3
4export default async function(interval: Interval) {
5 let weather = await getWeather("St. John's, NL");
6 let temperature = weather.current_condition[0].FeelsLikeC;
1import { email } from "https://esm.town/v/std/email";
2
3export default async function (interval: Interval) {
4 try {
5 const response = await fetch("https://seths.blog/feed/");
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
7 return html.replace(/^```html\n?/, "").replace(/\n?```$/, "");
8}
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);