8import _ from "npm:lodash@4";
9
10async function main(req: Request): Promise<Response> {
11 const { readable, writable } = new TransformStream();
12 const writer = writable.getWriter();
20 <script>
21 // Scroll to the bottom of the page when the page changes.
22 (new MutationObserver(function (mutationsList, observer) {
23 window.scrollTo({ left: 0, top: document.body.scrollHeight, behavior: "instant" });
24 })).observe(document, { childList: true, characterData: true, subtree: true });
47 Your response should start with \`\`\`ts and end with \`\`\`, so full code fences.
48 There should be no comments like "more content here", it should be complete and directly runnable.
49 The val should have an "export default async function main". The val should return a valid HTML website.
50 Prefer using Tailwind. Put frontend functions in a <script> tag, using dangerouslySetInnerHTML. Don't use Hono. Don't use Response.redirect.
51 `.replace("\n", " "),
52 },
136
137export const service = (boardUrl: string, options?: ServiceOptions) => {
138 return async function(req: Request): Promise<Response> {
139 const url = new URL(req.url);
140 const path = url.pathname;
1const Airtable = require("airtable");
2
3export default async function saveToAirtable(videoName, videoDescription, videoCover, videoFile, clientLogo) {
4 // Set up your Airtable API key and base ID
5 const API_KEY = "patrq3goiFF1u09Dz.b435affff5fb534b9d5c76e2544ddf88612d6a19aebaec5c14f9434b0d10d2e6";
26}
27
28function App({ requests, stats, fullRequest }: { requests: RequestData[], stats: Stats, fullRequest?: RequestData }) {
29 return (
30 <div>
84}
85
86export default async function server(request: Request): Promise<Response> {
87 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
88 const SCHEMA_VERSION = 1;
9import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
10
11export default reloadOnSaveFetchMiddleware(async function(req: Request): Promise<Response> {
12 return html(`<h1>Hello!!</h1>`);
13})
8
9// this script runs client-side
10export const reloadOnVals = async function(vals: ValRef[]) {
11 const valVersions = await Promise.all(vals.map(getCurrentValVersionNumber));
12 // console.log("initialValVersions: ", valVersions);
22
23// experimental - don't use this
24export function reloadOnSaveHonoMiddleware(vals: ValRef[] = [rootValRef()]): MiddlewareHandler {
25 return async function(c, next) {
26 await next();
27 // don't reload on custom domains, only reload on val.run URLs
40 * @param vals to watch
41 */
42export function reloadOnSaveFetchMiddleware(
43 handler: (req: Request) => Response | Promise<Response>,
44 vals = [rootValRef()],
18];
19
20function App() {
21 const [votes, setVotes] = useState({});
22 const [selectedLocation, setSelectedLocation] = useState(null);
98}
99
100function client() {
101 createRoot(document.getElementById("root")).render(<App />);
102}
106}
107
108async function server(request: Request): Promise<Response> {
109 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
110 const SCHEMA_VERSION = 1;
9import { OpenAI } from "https://esm.town/v/std/openai";
10
11export default async function server(request: Request): Promise<Response> {
12 const url = new URL(request.url);
13 const code = url.searchParams.get("code") || "console.log(\"Hello, World!\");";
75 hljs.highlightAll();
76
77 function shuffleGradient() {
78 const t1 = Math.random();
79 const t2 = (t1 + 0.3) % 1; // Ensure colors are distinct
91 const duration = 10000; // 10 seconds
92
93 function animate(timestamp) {
94 if (!start) start = timestamp;
95 const progress = (timestamp - start) / duration;
12}
13
14function App() {
15 const [summary, setSummary] = useState<string>("");
16 const [loading, setLoading] = useState<boolean>(true);
135}
136
137function client() {
138 createRoot(document.getElementById("root")).render(<App />);
139}
143}
144
145async function server(request: Request): Promise<Response> {
146 const url = new URL(request.url);
147
7import { default as Parse } from "npm:rss-to-json";
8
9export default async function notify() {
10 try {
11 // Fetch and parse the RSS feed