usageAlertmain.tsx1 match
2import { email } from "https://esm.town/v/std/email?v=13";
34export function usageAlert(handler: (req: Request) => Promise<Response>) {
5const requestCounts: number[] = [];
6const LIMIT = 1000;
usageAlertREADME.md1 match
9import { usageAlert } from "https://esm.town/v/stevekrouse/usageAlert"
1011async function sampleHandler(req: Request): Promise<Response> {
12return new Response("Hello, World!");
13}
fastCoffeeLizardmain.tsx2 matches
4const secret = "cfbd87a697526bf25127f998fe6388684b80524be46062a1a79d6dd26b5a6b90";
56async function verifySignature(bodyText, receivedSignature) {
7const encoder = new TextEncoder();
8const keyData = encoder.encode(secret);
126127<script>
128async function fetchData() {
129try {
130const response = await fetch(window.location.href, { headers: { 'accept': 'application/json' } });
sqliteExplorerAppREADME.md1 match
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37
whoIsHiringmain.tsx3 matches
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
89function App() {
10const tabs = { "/": "Home", "/about": "About" };
11const [activeTab, setActiveTab] = useState("/");
362}
363364function ServerApp() {
365return (
366<html>
385}
386387export default async function(req: Request): Promise<Response> {
388const url = new URL(req.url);
389if (url.pathname === "/api/stories") {
diligentSapphireOrcamain.tsx5 matches
1export default async function(req: Request): Response {
2const url = new URL(req.url);
3
136const connectionStatus = document.querySelector("#connection-status");
137
138// Dropdown menu functionality
139const menuButton = document.getElementById('menuButton');
140const menuDropdown = document.getElementById('menuDropdown');
209});
210211function parseResponse(text) {
212const parts = [];
213let currentText = "";
256});
257
258document.getElementById("input").addEventListener("submit", async function(event) {
259event.preventDefault();
260const userMessage = event.target.message.value;
359
360document.querySelectorAll(".suggestion-button").forEach((button)=>{
361button.addEventListener("click", function() {
362const input = document.querySelector("input[name=\\"message\\"]");
363input.value = this.textContent;
wittyTurquoiseDovemain.tsx12 matches
12}
1314function QuickCommand({ label, onClick }: { label: string; onClick: () => void }) {
15return (
16<button className="quick-command" onClick={onClick}>
20}
2122function App() {
23const [prompt, setPrompt] = useState("hello llamapalooza");
24const [code, setCode] = useState("");
104label: "Mobile-First Layout",
105prompt:
106"Design a Mobile-First Layout that prioritizes mobile device usability and performance, ensuring that the design scales up effectively for larger screens while maintaining functionality and aesthetics on smaller devices.",
107},
108{
208}, []);
209210async function fetchSavedSnippets() {
211const response = await fetch("/snippets");
212const snippets = await response.json();
214}
215216async function handleSave() {
217if (!code) return;
218const response = await fetch("/snippets", {
226}
227228async function handleDelete(id: number) {
229const response = await fetch(`/snippets/${id}`, { method: "DELETE" });
230if (response.ok) {
233}
234235async function handleSubmit(e: React.FormEvent) {
236e.preventDefault();
237setLoading(true);
257}
258259function handleBack() {
260if (currentIndex > 0) {
261setCurrentIndex(currentIndex - 1);
264}
265266function handleForward() {
267if (currentIndex < history.length - 1) {
268setCurrentIndex(currentIndex + 1);
391}
392393function client() {
394createRoot(document.getElementById("root")!).render(<App />);
395}
399}
400401function extractCodeFromFence(text: string): string {
402const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
403return htmlMatch ? htmlMatch[1].trim() : text;
404}
405406export default async function server(req: Request): Response {
407const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
408const KEY = "wittyTurquoiseDove";
zwiftPortalScheduleREADME.md1 match
47import { email } from "https://esm.town/v/std/email";
4849export default async function sendZwiftPortalSchedule(interval: Interval) {
50console.log("Parsing Zwift portal road schedule...");
51
RobotBackupCallGraphmain.tsx15 matches
2import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL?v=2";
34export default async function server(req: Request): Promise<Response> {
5// Handle GET requests
6if (req.method === "GET") {
288layout: {
289name: 'preset',
290positions: function(node) {
291return { x: 0, y: 0 }; // Initial positions, will be overwritten
292}
297});
298299// Custom layout function
300function customLayout() {
301const mainGraph = cy.elements().not('#isolated, #isolated > node');
302const isolatedGraph = cy.getElementById('isolated');
349350// Add event listeners for highlighting
351cy.on('mouseover', 'node', function(e) {
352const node = e.target;
353highlightNodeChildrenAndParents(node);
354});
355356cy.on('mouseout', 'node', function(e) {
357unhighlightAll();
358});
359360cy.on('click', 'node', function(e) {
361const node = e.target;
362if (node.hasClass('highlighted') || node.hasClass('parent-highlighted')) {
368});
369370function highlightNodeChildrenAndParents(node) {
371const children = node.outgoers();
372const parents = node.incomers();
376}
377378function unhighlightAll() {
379cy.elements().removeClass('highlighted');
380cy.elements().removeClass('parent-highlighted');
529let match;
530while ((match = callRegex.exec(line)) !== null) {
531const calledFunction = match[1].toLowerCase();
532relationships.get(caller).add(calledFunction);
533allNodes.add(calledFunction);
534}
535});
545546const edges = [];
547relationships.forEach((calledFunctions, file) => {
548calledFunctions.forEach(calledFunction => {
549edges.push({
550data: {
551source: file,
552target: calledFunction,
553},
554});
createFileInputAppmain.tsx1 match
1export default function server(req: Request): Response {
2return new Response(`
3<!DOCTYPE html>