cerebras_codermain.tsx11 matches
24);
2526function Hero({
27prompt,
28setPrompt,
4546<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
47Turn your ideas into fully functional apps in{" "}
48<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
49less than a second
116}
117118function App() {
119const previewRef = React.useRef<HTMLDivElement>(null);
120const [prompt, setPrompt] = useState("");
170});
171172function handleStarterPromptClick(promptItem: typeof prompts[number]) {
173setLoading(true);
174setTimeout(() => handleSubmit(promptItem.prompt), 0);
175}
176177async function handleSubmit(e: React.FormEvent | string) {
178if (typeof e !== "string") {
179e.preventDefault();
226}
227228function handleVersionChange(direction: "back" | "forward") {
229const { currentVersionIndex, versions } = versionHistory;
230if (direction === "back" && currentVersionIndex > 0) {
974);
975976function client() {
977const path = window.location.pathname;
978const root = createRoot(document.getElementById("root")!);
1010}
10111012function extractCodeFromFence(text: string): string {
1013const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
1014return htmlMatch ? htmlMatch[1].trim() : text;
1015}
10161017async function generateCode(prompt: string, currentCode: string) {
1018const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
1019if (starterPrompt) {
1060}
10611062export default async function cerebras_coder(req: Request): Promise<Response> {
1063// Dynamic import for SQLite to avoid client-side import
1064const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1163<meta property="og:site_name" content="Cerebras Coder">
1164<meta property="og:url" content="https://cerebrascoder.com"/>
1165<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."">
1166<meta property="og:type" content="website">
1167<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
codeLearnerProAppmain.tsx6 matches
43advanced: `
44# Decorators
45def log_function(func):
46def wrapper(*args, **kwargs):
47print(f"Calling {func.__name__}")
49return wrapper
5051@log_function
52def example_function():
53pass
54`
56};
5758function App() {
59const [activeSection, setActiveSection] = useState('python');
60const [activeSubSection, setActiveSubSection] = useState('beginner');
259};
260261function client() {
262createRoot(document.getElementById("root")).render(<App />);
263}
264if (typeof document !== "undefined") { client(); }
265266export default async function server(request: Request): Promise<Response> {
267return new Response(`
268<html>
onlineGamesAPKmain.tsx4 matches
24];
2526function GameCard({ game }) {
27return (
28<div style={{
58}
5960function App() {
61return (
62<div style={{
94}
9596function client() {
97createRoot(document.getElementById("root")).render(<App />);
98}
99if (typeof document !== "undefined") { client(); }
100101export default async function server(request: Request): Promise<Response> {
102return new Response(`
103<html>
responsiveMagentaBearmain.tsx3 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function RunningGame() {
6const [targetDistance, setTargetDistance] = useState(Math.floor(Math.random() * 5) + 1); // 1-5 km
7const [currentDistance, setCurrentDistance] = useState(0);
119}
120121function client() {
122createRoot(document.getElementById("root")).render(<RunningGame />);
123}
124if (typeof document !== "undefined") { client(); }
125126export default async function server(request: Request): Promise<Response> {
127return new Response(`
128<html>
inspiringAquaToadmain.tsx2 matches
89// Home/Match Screen
10function HomeMatchScreen({ setScreen }) {
11const [matches, setMatches] = useState([
12{
138139// Main App Component
140function App() {
141const [screen, setScreen] = useState('home');
142const [profileData, setProfileData] = useState({});
xoGameWithDifficultyLevelsmain.tsx11 matches
8type MiniBoard = Board;
910function calculateWinner(board: Board): Player | null {
11const lines = [
12[0, 1, 2],
28}
2930function MiniBoard({
31board,
32onCellClick,
56}
5758function App() {
59const [metaBoard, setMetaBoard] = useState<(Player | null)[]>(Array(9).fill(null));
60const [miniBoardStates, setMiniBoardStates] = useState<MiniBoard[]>(
78}, [xIsNext, metaBoard]);
7980async function makeAIMove() {
81setIsAIThinking(true);
82try {
104}
105106function handleMiniMove(miniBoardIndex: number, cellIndex: number) {
107if (
108(currentMiniBoard !== null && currentMiniBoard !== miniBoardIndex) ||
131}
132133function calculateNextAllowedBoard(lastMoveCellIndex: number): number | null {
134// If the corresponding mini board is already won or full, allow any open board
135if (metaBoard[lastMoveCellIndex] || miniBoardStates[lastMoveCellIndex].every(cell => cell !== null)) {
141}
142143function resetGame() {
144setMetaBoard(Array(9).fill(null));
145setMiniBoardStates(Array(9).fill(null).map(() => Array(9).fill(null)));
208}
209210function client() {
211createRoot(document.getElementById("root")).render(<App />);
212}
213if (typeof document !== "undefined") { client(); }
214215export default async function server(request: Request): Promise<Response> {
216if (request.method === "POST" && new URL(request.url).pathname === "/ai-move") {
217const { metaBoard, miniBoardStates, currentMiniBoard, difficulty } = await request.json();
246}
247248function calculateWinningMoves(board: Board): number[] {
249const lines = [
250[0, 1, 2],
267}
268269async function calculateAIMove(
270metaBoard: Board,
271miniBoardStates: MiniBoard[],
ardentTomatoMarmosetmain.tsx3 matches
19};
2021function App() {
22const [activeSection, setActiveSection] = useState('history');
23133};
134135function client() {
136createRoot(document.getElementById("root")).render(<App />);
137}
138if (typeof document !== "undefined") { client(); }
139140export default async function server(request: Request): Promise<Response> {
141return new Response(`
142<html>
Wilayatwaymain.tsx3 matches
19};
2021function App() {
22const [activeSection, setActiveSection] = useState('history');
23133};
134135function client() {
136createRoot(document.getElementById("root")).render(<App />);
137}
138if (typeof document !== "undefined") { client(); }
139140export default async function server(request: Request): Promise<Response> {
141return new Response(`
142<html>
pythonLearningAppmain.tsx4 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function PythonLearningApp() {
6const [topic, setTopic] = useState('');
7const [explanation, setExplanation] = useState('');
51value={topic}
52onChange={(e) => setTopic(e.target.value)}
53placeholder="Enter Python topic (e.g., lists, functions, classes)"
54style={styles.input}
55/>
154};
155156function client() {
157createRoot(document.getElementById("root")).render(<PythonLearningApp />);
158}
159if (typeof document !== "undefined") { client(); }
160161export default async function server(request: Request): Promise<Response> {
162// Log the incoming request for debugging
163console.log('Incoming request:', request.method, request.url);
1export default async function (interval: Interval) {
2
3}