cerebras_codermain.tsx10 matches
11type PromptItem = typeof prompts[number];
1213function Hero({
14prompt,
15setPrompt,
4950<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
51Turn your ideas into fully functional apps in{" "}
52<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
53less than a second
120}
121122function App() {
123const previewRef = React.useRef<HTMLDivElement>(null);
124const [prompt, setPrompt] = useState("");
173});
174175function handleStarterPromptClick(promptItem: typeof prompts[number]) {
176setLoading(true);
177setTimeout(() => handleSubmit(promptItem.prompt), 0);
178}
179180async function handleSubmit(e: React.FormEvent | string) {
181if (typeof e !== "string") {
182e.preventDefault();
229}
230231function handleVersionChange(direction: "back" | "forward") {
232const { currentVersionIndex, versions } = versionHistory;
233if (direction === "back" && currentVersionIndex > 0) {
992);
993994function client() {
995const path = window.location.pathname;
996const root = createRoot(document.getElementById("root")!);
1028}
10291030function extractCodeFromFence(text: string): string {
1031const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1032return htmlMatch ? htmlMatch[1].trim() : text;
1033}
10341035async function generateCode(prompt: string, currentCode: string) {
1036const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1037if (starterPrompt) {
1074}
10751076export default async function server(req: Request): Promise<Response> {
1077// Dynamic import for SQLite to avoid client-side import
1078const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
hardworkingLimeCheetahmain.tsx10 matches
12type PromptItem = typeof prompts[number];
1314function Hero({
15prompt,
16setPrompt,
5051<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
52Turn your ideas into fully functional apps in{" "}
53<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
54less than a second
121}
122123function App() {
124const previewRef = React.useRef<HTMLDivElement>(null);
125const [prompt, setPrompt] = useState("");
174});
175176function handleStarterPromptClick(promptItem: typeof prompts[number]) {
177setLoading(true);
178setTimeout(() => handleSubmit(promptItem.prompt), 0);
179}
180181async function handleSubmit(e: React.FormEvent | string) {
182if (typeof e !== "string") {
183e.preventDefault();
230}
231232function handleVersionChange(direction: "back" | "forward") {
233const { currentVersionIndex, versions } = versionHistory;
234if (direction === "back" && currentVersionIndex > 0) {
993);
994995function client() {
996const path = window.location.pathname;
997const root = createRoot(document.getElementById("root")!);
1029}
10301031function extractCodeFromFence(text: string): string {
1032const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1033return htmlMatch ? htmlMatch[1].trim() : text;
1034}
10351036async function generateCode(prompt: string, currentCode: string) {
1037const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1038if (starterPrompt) {
1075}
10761077export default async function server(req: Request): Promise<Response> {
1078// Dynamic import for SQLite to avoid client-side import
1079const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
strategiesHelpersmain.tsx2 matches
777}
778779function predictDraw(teamA, teamB, tournament) {
780if (!teamA || !teamB) return 0;
781782// Helper function to calculate draw rate
783const calculateDrawRate = (team) =>
784team.results.draws / team.totalMatches;
calmRoseCaterpillarmain.tsx11 matches
39);
4041function App() {
42const [functionInput, setFunctionInput] = useState("");
43const [mermaidDiagram, setMermaidDiagram] = useState("");
44const [error, setError] = useState("");
70"Content-Type": "application/json",
71},
72body: JSON.stringify({ function: functionInput }),
73});
74102},
103body: JSON.stringify({
104functionDescription: functionInput,
105currentMermaidCode: `\`\`\`mermaid\n${mermaidDiagram}\n\`\`\``,
106}),
148<div style={styles.container}>
149<div style={styles.header}>
150<h1 style={styles.title}>🔍 Function Diagram Generator</h1>
151<p style={styles.subtitle}>Transform code into visual flowcharts</p>
152</div>
154<form onSubmit={handleSubmit} style={styles.form}>
155<textarea
156value={functionInput}
157onChange={(e) => setFunctionInput(e.target.value)}
158placeholder="Paste your function here... (JavaScript/TypeScript)"
159style={styles.textarea}
160rows={10}
334};
335336function client() {
337createRoot(document.getElementById("root")).render(<App />);
338}
339if (typeof document !== "undefined") { client(); }
340341export default async function server(request: Request): Promise<Response> {
342if (request.method === "PUT") {
343try {
372<html>
373<head>
374<title>Function Mermaid Diagram Generator</title>
375<meta name="viewport" content="width=device-width, initial-scale=1">
376<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
pythonHTTPValmain.tsx1 match
1import { runPythonCode } from "https://deno.land/x/py_town@v0.0.8/mod.ts";
23export default async function handler(req: Request): Promise<Response> {
4const pythonCode = `
5import numpy as np
postMessageButtonGamemain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const handlePostMessage = () => {
7window.parent.postMessage('{"data": "foo", "field": "expected", "type": "update"}', '*');
29}
3031function client() {
32createRoot(document.getElementById("root")).render(<App />);
33}
34if (typeof document !== "undefined") { client(); }
3536export default async function server(request: Request): Promise<Response> {
37return new Response(`
38<html>
wholeFoodsRSSmain.tsx1 match
2import { wholefoodssales } from "https://esm.town/v/Glench/wholefoodssales";
34export default async function(req: Request): Promise<Response> {
5return new Response(dataToRSS(await wholefoodssales(), {
6title: "Whole Foods Sales — Personal",
3import process from "node:process";
45export const tvshows = async function() {
6const TV_SHOWS_WATCHED = [
7// Ted Lasso
28data.push(show);
29}
30data.sort(function(a, b) {
31if (a.last_air_date > b.last_air_date)
32return -1;
blob_adminmain.tsx8 matches
13}
1415function Tooltip({ children, content }: TooltipProps) {
16const [isVisible, setIsVisible] = useState(false);
17const tooltipRef = useRef<HTMLDivElement>(null);
52}
5354function formatBytes(bytes: number, decimals = 2) {
55if (bytes === 0) return "0 Bytes";
56const k = 1024;
61}
6263function copyToClipboard(text: string) {
64navigator.clipboard.writeText(text).then(() => {
65console.log("Text copied to clipboard");
69}
7071function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72const [isOpen, setIsOpen] = useState(false);
73const menuRef = useRef(null);
7677useEffect(() => {
78function handleClickOutside(event) {
79if (menuRef.current && !menuRef.current.contains(event.target)) {
80event.stopPropagation();
158}
159160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161const [isLoading, setIsLoading] = useState(false);
162const decodedKey = decodeURIComponent(blob.key);
219}
220221function App({ initialEmail, initialProfile }) {
222const encodeKey = (key: string) => encodeURIComponent(key);
223const decodeKey = (key: string) => decodeURIComponent(key);
645}
646647function client() {
648const initialEmail = document.getElementById("root").getAttribute("data-email");
649const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));
pyodideSetupmain.tsx1 match
1const pyodideUrl = "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/";
23export async function initializePyodide() {
4// Set up the global objects that Pyodide expects
5(globalThis as any).window = globalThis;