town-hallErrorMessage.tsx1 match
7}
89export function ErrorMessage({ message, onDismiss }: ErrorMessageProps) {
10return (
11<div
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) {
921);
922923function client() {
924const path = window.location.pathname;
925const root = createRoot(document.getElementById("root")!);
957}
958959function extractCodeFromFence(text: string): string {
960const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
961return htmlMatch ? htmlMatch[1].trim() : text;
962}
963964async function generateCode(prompt: string, currentCode: string) {
965const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
966if (starterPrompt) {
1007}
10081009export default async function cerebras_coder(req: Request): Promise<Response> {
1010// Dynamic import for SQLite to avoid client-side import
1011const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1110<meta property="og:site_name" content="Cerebras Coder">
1111<meta property="og:url" content="https://cerebrascoder.com"/>
1112<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."">
1113<meta property="og:type" content="website">
1114<meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
ValTown-Package-Trackerindex.html8 matches
139
140// Initialize the application
141async function init() {
142await loadDevices();
143await loadLocations();
149
150// Load devices for the selector
151async function loadDevices() {
152try {
153const response = await fetch('/api/devices');
172
173// Load location data
174async function loadLocations() {
175try {
176const deviceId = deviceSelector.value;
200
201// Clear map markers and polyline
202function clearMap() {
203markers.forEach(marker => map.removeLayer(marker));
204markers = [];
211
212// Add locations to the map
213function addLocationsToMap(locations) {
214if (!locations.length) {
215locationHistory.innerHTML = '<p class="text-gray-500 italic">No location data available</p>';
283
284// Show location details in the info panel
285function showLocationDetails(location) {
286// Parse the gateways JSON string if needed
287let gateways = [];
364
365// Update the location history panel
366function updateLocationHistory() {
367if (!locations.length) {
368locationHistory.innerHTML = '<p class="text-gray-500 italic">No location history available</p>';
421
422// Highlight the selected history item
423function highlightHistoryItem(id) {
424document.querySelectorAll('.location-item').forEach(item => {
425if (parseInt(item.dataset.id) === id) {
15};
1617function isInNorthAmerica(lat: number, lng: number): boolean {
18return (
19lat >= NA_BOUNDS.latMin &&
ipv4-counterdatabase.ts4 matches
16* Initialize the database with our table
17*/
18export async function initDatabase() {
19await sqlite.execute(`
20CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
33* If not, create a new record
34*/
35export async function recordVisit(ip: string): Promise<void> {
36const now = new Date().toISOString();
37await sqlite.execute(
48* Get all visit records
49*/
50export async function getAllVisits(): Promise<VisitRecord[]> {
51const result = await sqlite.execute(
52`SELECT * FROM ${TABLE_NAME} ORDER BY visits DESC`,
59* Get total visit count across all IPs
60*/
61export async function getTotalVisits(): Promise<number> {
62const result = await sqlite.execute(
63`SELECT SUM(visits) as total FROM ${TABLE_NAME}`,
subdomainsreels.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
subdomainslnk.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
subdomainslink.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
subdomainsurl.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}
subdomainsroute.tsx1 match
1export default async function (req: Request): Promise<Response> {
2return Response.json({ ok: true })
3}