9const thisURL = parseProject(import.meta.url).links.self.project;
1011function StatusRow({ rows }) {
12return (
13<div className="w-full flex flex-col space-y-2">
31}
3233function StatusSection({ url, rows }) {
34const sectionRows = rows.filter(row => row[0] === url);
35const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
4849export default async function(req: Request): Promise<Response> {
50const { rows } = await sqlite.execute(
51"select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",
statussparklineSVG1 match
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3const padding = 2;
4const xMargin = 25;
4const thisURL = parseProject(import.meta.url).links.self.latest;
56export async function notify(message: string) {
7await email({ subject: message, text: `Email sent from ${thisURL}` });
8}
7);
89export async function uptimeCheck(url: string, attempt = 1) {
10let reason: string = "";
11let status: number | null = null;
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
brightEmeraldQuokkamain.tsx3 matches
29];
3031function App() {
32const [noClicks, setNoClicks] = useState(0);
33const [isValentine, setIsValentine] = useState(false);
114}
115116function client() {
117createRoot(document.getElementById("root")).render(<App />);
118}
119if (typeof document !== "undefined") { client(); }
120121export default async function server(request: Request): Promise<Response> {
122return new Response(
123`
jovialTurquoiseVicunamain.tsx3 matches
28];
2930function App() {
31const [noClicks, setNoClicks] = useState(0);
32const [isValentine, setIsValentine] = useState(false);
113}
114115function client() {
116createRoot(document.getElementById("root")).render(<App />);
117}
118if (typeof document !== "undefined") { client(); }
119120export default async function server(request: Request): Promise<Response> {
121return new Response(
122`
mathOfTheDayaccomplishedOrangePenguin15 matches
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
67function renderMath(text) {
8if (!text) return "";
9return text.replace(/\$\$(.*?)\$\$|\$(.*?)\$/g, (match, eq1, eq2) => {
21}
2223function App() {
24const [problem, setProblem] = useState(null);
25const [userAnswer, setUserAnswer] = useState("");
100<ul>
101<li>
102Functions: <code>sin(x)</code>, <code>cos(x)</code>, <code>tan(x)</code>
103</li>
104<li>
105Inverse functions: <code>arcsin(x)</code> or <code>sin^{-1}(x)</code>
106</li>
107<li>
150}
151152function normalizeAnswer(answer) {
153// Remove all spaces and convert to lowercase
154answer = answer.replace(/\s+/g, "").toLowerCase();
155156// Standardize trig function notations
157answer = answer.replace(/arcsin/g, "sin^{-1}");
158answer = answer.replace(/arccos/g, "cos^{-1}");
180}
181182function client() {
183createRoot(document.getElementById("root")).render(<App />);
184}
188}
189190export default async function server(request) {
191const { OpenAI } = await import("https://esm.town/v/std/openai");
192const { blob } = await import("https://esm.town/v/std/blob");
209},
210],
211functions: [
212{
213name: "generate_math_problem",
233},
234],
235function_call: { name: "generate_math_problem" },
236});
237238const functionCall = completion.choices[0].message.function_call;
239if (!functionCall || functionCall.name !== "generate_math_problem") {
240return new Response("Failed to generate problem", { status: 500 });
241}
243let problem;
244try {
245problem = JSON.parse(functionCall.arguments);
246} catch (error) {
247console.error("Failed to parse function call arguments:", error);
248console.log("Raw arguments:", functionCall.arguments);
249return new Response("Failed to generate problem", { status: 500 });
250}
imageToWebPConvertermain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom/client";
45function App() {
6const [imageUrl, setImageUrl] = useState(null);
7const [webpUrl, setWebpUrl] = useState(null);
93}
9495function client() {
96createRoot(document.getElementById("root")).render(<App />);
97}
99if (typeof document !== "undefined") { client(); }
100101export default async function server(request: Request): Promise<Response> {
102return new Response(`
103<!DOCTYPE html>
parseImportMetaproject.test3 matches
94}
9596function runTest(test: TestCase) {
97let pass, message;
98let start = performance.now();
111}
112113function renderBadge({ label, passedCount, testCount }: { label?: string; passedCount: number; testCount: number }) {
114return makeBadge({
115label: label ?? "Tests",
119}
120121function renderTestResults(tests: TestCase[], outputs: TestOutput[]) {
122const passedCount = outputs.filter((output: TestOutput) => output.pass).length;
123const testCount = tests.length;