MultiImageCompressormain.tsx2 matches
10}
1112function ImageCompressor() {
13const [images, setImages] = React.useState<CompressedImage[]>([]);
14const [totalCompressed, setTotalCompressed] = React.useState(0);
324}
325326export default async function server(request: Request): Promise<Response> {
327return new Response(`
328<html>
getRandomWordmain.tsx2 matches
1// Use Web Crypto API for hashing instead of Deno's standard library
2async function hashSeed(seed: string): Promise<string> {
3const encoder = new TextEncoder();
4const data = encoder.encode(seed);
12let wordListCache: string[] | null = null;
1314export async function getRandomWord(
15seed?: string,
16min: number = 3,
tape_test_examplemain.tsx4 matches
1import test from "npm:tape";
23test("timing test", function(t) {
4t.plan(2);
56t.equal(typeof Date.now, "function");
7var start = Date.now();
89setTimeout(function() {
10t.equal(Date.now() - start, 100);
11}, 100);
12});
1314test("test using promises", async function(t) {
15const result = await someAsyncThing();
16t.ok(result);
34}
3536function ComponentGenerator() {
37const [prompt, setPrompt] = useState("");
38const [generatedCode, setGeneratedCode] = useState("");
62try {
63// eslint-disable-next-line no-new-func
64const ComponentFunc = new Function('React', `return (${code})`)();
65setParsedComponent(() => ComponentFunc);
66} catch (parseError) {
103value={prompt}
104onChange={(e) => setPrompt(e.target.value)}
105placeholder="Describe your React component (e.g., 'A todo list with add and delete functionality')"
106className="flex-grow p-3 rounded-l-lg bg-gray-800 text-white"
107/>
157}
158159function App() {
160return <ComponentGenerator />;
161}
162163function client() {
164const root = document.getElementById("root");
165if (root) {
172}
173174export default async function server(request: Request): Promise<Response> {
175if (request.method === "POST" && new URL(request.url).pathname === "/generate-component") {
176const { prompt } = await request.json();
186role: "system",
187content: `You are an expert React component generator.
188Generate a complete, functional React component based on the user's description.
189- Use modern React with functional components and hooks
190- Include necessary imports (import React from 'react')
191- Provide a fully working component
193- Handle basic interactions and state management
194- Ensure the component is self-contained and renders correctly
195- Return ONLY the component function, not the full file
196- Wrap the function in parentheses () => { ... }`
197},
198{
cerebras_codermain.tsx11 matches
75const PoweredByInfo = "";
7677function Hero({
78prompt,
79setPrompt,
9697<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
98Turn your ideas into fully functional apps in{" "}
99<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
100less than a second
170}
171172function App() {
173const previewRef = React.useRef<HTMLDivElement>(null);
174const [prompt, setPrompt] = useState("");
224});
225226function handleStarterPromptClick(promptItem: typeof prompts[number]) {
227setLoading(true);
228setTimeout(() => handleSubmit(promptItem.prompt), 0);
229}
230231async function handleSubmit(e: React.FormEvent | string) {
232if (typeof e !== "string") {
233e.preventDefault();
280}
281282function handleVersionChange(direction: "back" | "forward") {
283const { currentVersionIndex, versions } = versionHistory;
284if (direction === "back" && currentVersionIndex > 0) {
996);
997998function client() {
999const path = window.location.pathname;
1000const root = createRoot(document.getElementById("root")!);
1032}
10331034function extractCodeFromFence(text: string): string {
1035const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1036return htmlMatch ? htmlMatch[1].trim() : text;
1037}
10381039async function generateCode(prompt: string, currentCode: string) {
1040const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1041if (starterPrompt) {
1082}
10831084export default async function cerebras_coder(req: Request): Promise<Response> {
1085// Dynamic import for SQLite to avoid client-side import
1086const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1185<meta property="og:site_name" content="Cerebras Coder">
1186<meta property="og:url" content="https://cerebrascoder.com"/>
1187<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1188<meta property="og:type" content="website">
1189<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
cerebrasTemplatemain.tsx2 matches
242};
243244function client() {
245createRoot(document.getElementById("root")).render(<SubscriptionTracker />);
246}
248if (typeof document !== "undefined") { client(); }
249250export default async function server(request: Request): Promise<Response> {
251const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
252const KEY = "cerebrasTemplate";
cerebrasTemplatemain.tsx3 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
71}
7273function client() {
74createRoot(document.getElementById("root")).render(<App />);
75}
79}
8081export default async function server(request: Request): Promise<Response> {
82if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
83const { messages } = await request.json();
cerebrasTemplatemain.tsx3 matches
3import React, { useState } from "https://esm.sh/react@18.2.0";
45function App() {
6const [messages, setMessages] = useState([]);
7const [input, setInput] = useState("");
71}
7273function client() {
74createRoot(document.getElementById("root")).render(<App />);
75}
79}
8081export default async function server(request: Request): Promise<Response> {
82if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
83const { messages } = await request.json();
hopefulGoldChinchillamain.tsx11 matches
73const PoweredByInfo = "";
7475function Hero({
76prompt,
77setPrompt,
9495<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
96Turn your ideas into fully functional apps in{" "}
97<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
98less than a second
168}
169170function App() {
171const previewRef = React.useRef<HTMLDivElement>(null);
172const [prompt, setPrompt] = useState("");
222});
223224function handleStarterPromptClick(promptItem: typeof prompts[number]) {
225setLoading(true);
226setTimeout(() => handleSubmit(promptItem.prompt), 0);
227}
228229async function handleSubmit(e: React.FormEvent | string) {
230if (typeof e !== "string") {
231e.preventDefault();
278}
279280function handleVersionChange(direction: "back" | "forward") {
281const { currentVersionIndex, versions } = versionHistory;
282if (direction === "back" && currentVersionIndex > 0) {
994);
995996function client() {
997const path = window.location.pathname;
998const root = createRoot(document.getElementById("root")!);
1030}
10311032function extractCodeFromFence(text: string): string {
1033const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1034return htmlMatch ? htmlMatch[1].trim() : text;
1035}
10361037async function generateCode(prompt: string, currentCode: string) {
1038const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1039if (starterPrompt) {
1080}
10811082export default async function cerebras_coder(req: Request): Promise<Response> {
1083// Dynamic import for SQLite to avoid client-side import
1084const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1183<meta property="og:site_name" content="Cerebras Coder">
1184<meta property="og:url" content="https://cerebrascoder.com"/>
1185<meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1186<meta property="og:type" content="website">
1187<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">