graciousAmaranthMackerelmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const [image, setImage] = useState<File | null>(null);
7const [analysis, setAnalysis] = useState<string | null>(null);
199}
200201function client() {
202createRoot(document.getElementById("root")).render(<App />);
203}
204if (typeof document !== "undefined") { client(); }
205206export default async function server(request: Request): Promise<Response> {
207if (request.method === 'POST' && new URL(request.url).pathname === '/analyze') {
208const { OpenAI } = await import("https://esm.town/v/std/openai");
medicineLabelAnalyzerAppmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function App() {
6const [image, setImage] = useState<File | null>(null);
7const [analysis, setAnalysis] = useState<string | null>(null);
93}
9495function client() {
96createRoot(document.getElementById("root")).render(<App />);
97}
98if (typeof document !== "undefined") { client(); }
99100export default async function server(request: Request): Promise<Response> {
101if (request.method === 'POST' && new URL(request.url).pathname === '/analyze') {
102const { OpenAI } = await import("https://esm.town/v/std/openai");
tastefulIvoryWormmain.tsx1 match
4console.log("after 1s");
5});
6export default async function() {
7console.log("from within export");
8}
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
45function CeilingEscapeGame() {
6// Game state variables
7const [gameState, setGameState] = useState("waiting"); // Current game state (waiting, playing, escaped, gameOver, highScore)
44}, []);
4546// Function to save a new high score
47const saveHighScore = (newScore) => {
48const currentScores = JSON.parse(
62};
6364// Function to start the game
65const startGame = () => {
66// Randomize game duration between 2 - 5 seconds
75};
7677// Cubic Bezier easing function
78function cubicBezier(p1x, p1y, p2x, p2y) {
79return function(t) {
80const k = 1 - t;
81return 3 * k * k * t * p1y + 3 * k * t * t * p2y + t * t * t;
83}
8485// Custom easing function using cubicBezier
86function customEasing(t) {
87return cubicBezier(0.13, 0.00, 0.85, 0.51)(t);
88}
8990// Animate the ceiling's movement (unchanged, but uses the corrected customEasing)
91function animateCeiling() {
92const currentTime = Date.now();
93const elapsedTime = currentTime - startTimeRef.current;
96const progress = elapsedTime / gameDurationRef.current;
9798// Apply custom easing function to the progress
99const easedProgress = customEasing(progress);
100142intervalRef.current = setInterval(animate, 16);
143144// Cleanup function to cancel animation and clear interval
145return () => {
146if (animationRef.current) {
154}, [gameState]);
155156// Function to end the game
157const endGame = (survived) => {
158// Cancel any ongoing animations or intervals
206window.addEventListener("touchstart", handleTap);
207208// Cleanup function to remove event listeners
209return () => {
210window.removeEventListener("keydown", handleKeyPress);
264265useEffect(() => {
266// Function to generate confetti particles
267const generateConfetti = () => {
268const newConfetti = Array.from({ length: 50 }, () => ({
501502// Root component for the app
503function App() {
504return (
505<div
520521// Client-side rendering
522function client() {
523createRoot(document.getElementById("root")).render(<App />);
524}
530531// Server-side rendering (for potential future use)
532export default async function server(request: Request): Promise<Response> {
533return new Response(
534`
3import React, { useState, useEffect, useRef } from "https://esm.sh/react@18.2.0";
45function Map({ center, zoom, markers }) {
6const ref = useRef();
7const [map, setMap] = useState(null);
42}
4344function App() {
45const [messages, setMessages] = useState([]);
46const [input, setInput] = useState("");
146}
147148function client() {
149const script = document.createElement('script');
150script.src = `https://maps.googleapis.com/maps/api/js?key=${window.GOOGLE_MAPS_API_KEY}`;
161}
162163async function makeGoogleMapsApiCall(endpoint, params) {
164const baseUrl = "https://maps.googleapis.com/maps/api";
165const url = new URL(`${baseUrl}${endpoint}`);
177}
178179export default async function server(request: Request): Promise<Response> {
180if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
181const { messages, location } = await request.json();
AlwaysHere_migratedmain.tsx3 matches
9}
1011function App() {
12const [name, setName] = useState("");
13const [isNameEntered, setIsNameEntered] = useState(false);
263}
264265function client() {
266createRoot(document.getElementById("root")).render(<App />);
267}
271}
272273export default async function server(request: Request): Promise<Response> {
274// Handle voice processing
275if (request.method === "POST" && new URL(request.url).pathname === "/process-voice") {
cerebras_codermain.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">
oneshotdemopromptedmain.tsx4 matches
238}
239240function GameSimulator() {
241const [player, setPlayer] = useState(new Creature(20, 5, 3, Rarity.Rare, ElementType.Fire));
242const [enemies, setEnemies] = useState([
353}
354355function App() {
356return <GameSimulator />;
357}
358359function client() {
360createRoot(document.getElementById("root")).render(<App />);
361}
362if (typeof document !== "undefined") { client(); }
363364export default async function server(request: Request): Promise<Response> {
365return new Response(
366`
bedtimeStoryMakermain.tsx1 match
36// );
3738function parseStory(text) {
39// Split the text into lines and remove empty lines
40const lines = text.split("\n").filter(line => line.trim() !== "")
cerebras_codermain.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">