cerebras_codermain.tsx11 matches
26const PoweredByInfo = "";
2728function Hero({
29prompt,
30setPrompt,
4748<p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
49Turn your ideas into fully functional apps in{" "}
50<span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
51less than a second
121}
122123function App() {
124const previewRef = React.useRef<HTMLDivElement>(null);
125const [prompt, setPrompt] = useState("");
175});
176177function handleStarterPromptClick(promptItem: typeof prompts[number]) {
178setLoading(true);
179setTimeout(() => handleSubmit(promptItem.prompt), 0);
180}
181182async function handleSubmit(e: React.FormEvent | string) {
183if (typeof e !== "string") {
184e.preventDefault();
231}
232233function handleVersionChange(direction: "back" | "forward") {
234const { currentVersionIndex, versions } = versionHistory;
235if (direction === "back" && currentVersionIndex > 0) {
920);
921922function client() {
923const path = window.location.pathname;
924const root = createRoot(document.getElementById("root")!);
956}
957958function extractCodeFromFence(text: string): string {
959const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
960return htmlMatch ? htmlMatch[1].trim() : text;
961}
962963async function generateCode(prompt: string, currentCode: string) {
964const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
965if (starterPrompt) {
1006}
10071008export default async function cerebras_coder(req: Request): Promise<Response> {
1009// Dynamic import for SQLite to avoid client-side import
1010const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1109<meta property="og:site_name" content="Cerebras Coder">
1110<meta property="og:url" content="https://cerebrascoder.com"/>
1111<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."">
1112<meta property="og:type" content="website">
1113<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
TaskManagerAppmain.tsx6 matches
2526/** A form to create or edit a single task (used both stand-alone and in a modal). */
27function TaskForm({
28task,
29onSave,
179180/** A table that displays tasks. */
181function TaskList({
182tasks,
183onEditClick,
323}
324325function SettingsOverlay({
326columnWidths,
327onColumnWidthChange,
363}
364365function App() {
366const [tasks, setTasks] = useState<Task[]>([]);
367const [editingTask, setEditingTask] = useState<Task | undefined>(undefined);
597}
598599function client() {
600const rootElement = document.getElementById("root");
601if (rootElement) {
605if (typeof document !== "undefined") { client(); }
606607export default async function server(request: Request): Promise<Response> {
608return new Response(
609`
7const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
89export async function easyAQI({ location }: {
10location: string;
11}) {
redditAlertREADME.md2 matches
42- Value: Your SERP API key.
4344Without this key, the val will not function correctly.
4546---
58- Key: `mentionsDiscord`
59- Value: Your Discord webhook URL.
60Notifications will be sent using this function:
61```
62await discordWebhook({
redditAlertmain.tsx1 match
12const isProd = true;
1314export async function redditAlert({ lastRunAt }: Interval) {
15if (!SERP_API_KEY || !DISCORD_API_KEY) {
16console.error("Missing SERP_API_KEY or Discord webhook URL. Exiting.");
40- Key: `mentionsDiscord`
41- Value: Your Discord webhook URL.
42Notifications will be sent using this function:
43```
44await discordWebhook({
4import process from "node:process";
56export async function hnValTown({ lastRunAt }: Interval) {
7// Edit to update time frame
8const twoMonthsAgo = new Date();
billiardCafeAppmain.tsx5 matches
3import React, { useCallback, useEffect, useMemo, useRef, useState } from "https://esm.sh/react@18.2.0";
45function GameChallenge({ user, onGameEnd }) {
6const [level, setLevel] = useState(1);
7const [timeLeft, setTimeLeft] = useState(60);
102}
103104function App() {
105const [user, setUser] = useState(null);
106const [username, setUsername] = useState("");
273}
274275function client() {
276createRoot(document.getElementById("root")).render(<App />);
277}
278if (typeof document !== "undefined") { client(); }
279280export default async function server(request: Request): Promise<Response> {
281try {
282// Dynamically import sqlite with error handling
284try {
285sqlite = await import("https://esm.town/v/stevekrouse/sqlite");
286if (!sqlite || !sqlite.sqlite || typeof sqlite.sqlite.execute !== "function") {
287throw new Error("Invalid SQLite module");
288}
1export default async function server(request: Request): Promise<Response> {
2console.log("request", request);
3try {
86}
8788function generateICalFeed(events) {
89const icalLines = [
90"BEGIN:VCALENDAR",
110}
111112function formatICalDate(dateString) {
113if (!dateString) return "";
114const date = new Date(dateString);