8 "https://www.ikea.com/de/de/customer-service/services/buy-back/zweite-chance-markt-online-pub67d33610";
9
10 const apiUrl = `https://web-api.ikea.com/circular/circular-asis/offers/public/${locale}?size=64&stores=${
11 stores.join(",")
12 }&column=id&direction=desc&page=0`;
13 const storageKey = `ikeaSecondChanceOffers-${locale}-${stores.join(",")}-lastKnownItem`;
14
15 const response = await fetch(apiUrl);
16 const data: {
17 content: {
8 "https://www.ikea.com/de/de/customer-service/services/buy-back/zweite-chance-markt-online-pub67d33610";
9
10 const apiUrl = `https://web-api.ikea.com/circular/circular-asis/offers/public/${locale}?size=64&stores=${
11 stores.join(",")
12 }&column=id&direction=desc&page=0`;
13 const storageKey = `ikeaSecondChanceOffers-${locale}-${stores.join(",")}-lastKnownItem`;
14
15 const response = await fetch(apiUrl);
16 const data: {
17 content: {
11 },
12 {
13 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
14 "title": "Weather App",
15 "code": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>NYC Weather</title>\n <link href=\"https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css\" rel=\"stylesheet\">\n <style>\n .weather-icon {\n font-size: 48px;\n margin-bottom: 16px;\n }\n </style>\n</head>\n<body class=\"h-screen bg-blue-100 flex justify-center items-center p-4\">\n <div class=\"bg-white p-8 rounded-md shadow-md w-full max-w-sm md:p-12 lg:p-16 xl:p-20\">\n <h1 class=\"text-2xl font-bold mb-4 text-center text-blue-500\">NYC Weather</h1>\n <div id=\"weather\" class=\"mb-4 p-4 text-center\">\n <div id=\"temperature\" class=\"text-4xl font-bold mb-4\"></div>\n <div id=\"condition\" class=\"text-xl font-medium mb-4\"></div>\n <div id=\"humidity\" class=\"text-lg font-light mb-2\">Humidity: <span id=\"humidity-value\"></span>%</div>\n <div id=\"wind\" class=\"text-lg font-light mb-2\">Wind: <span id=\"wind-value\"></span> mph</div>\n <i id=\"weather-icon\" class=\"weather-icon text-blue-500\"></i>\n </div>\n </div>\n <p class=\"fixed bottom-0 left-0 right-0 text-center p-4 text-gray-600 md:p-6 lg:p-8 xl:p-10\">\n Built on <a class=\"text-blue-600\" href=\"https://cerebrascoder.com\">Cerebras Coder</a>\n </p>\n\n <script>\n // Sample weather data\n const weatherData = {\n temperature: 75,\n condition: 'Sunny',\n humidity: 60,\n wind: 10,\n icon: 'sun'\n };\n\n document.getElementById('temperature').innerText = `${weatherData.temperature}°F`;\n document.getElementById('condition').innerText = weatherData.condition;\n document.getElementById('humidity-value').innerText = weatherData.humidity;\n document.getElementById('wind-value').innerText = weatherData.wind;\n\n // Map weather icon\n const weatherIcons = {\n 'sun': '☀',\n 'cloud': '☀',\n 'rain': '☃',\n 'snow': '☄'\n };\n\n document.getElementById('weather-icon').innerHTML = weatherIcons[weatherData.icon] || '';\n </script>\n</body>\n</html>",
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in your project env variable called `CEREBRAS_API_KEY`
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
11 rel="stylesheet"
12 />
21 <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."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25
211 } catch (error) {
212 Toastify({
213 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
214 position: "center",
215 duration: 3000,
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [
76}
77
78// Fetch data from Neocities API
79async function fetchNeocitiesStats(sitename: string): Promise<any> {
80 try {
82
83 // Using a server-side fetch to avoid CSP issues
84 const response = await fetch(`https://neocities.org/api/info?sitename=${sitename}`, {
85 headers: {
86 // Add a User-Agent to be nice to the Neocities API
87 "User-Agent": "Neocities-Hit-Counter/1.0 (https://mbo-neocities_hit_counter.web.val.run)",
88 },
90
91 if (!response.ok) {
92 console.error(`Error fetching from Neocities API: ${response.status} ${response.statusText}`);
93 return null;
94 }
95
96 const data = await response.json();
97 console.log(`Received data from Neocities API:`, data);
98
99 return data;
274 <h2>How to use</h2>
275
276 <p>Use the <code>sitename</code> parameter to fetch the official hit count from the <a href="https://neocities.org/api">Neocities API</a>:</p>
277 <pre><img src="https://mbo-neocities_hit_counter.web.val.run?sitename=maxbo" alt="Hit count" /></pre>
278
338 const path = url.pathname.slice(1); // Remove leading slash
339
340 // Check for sitename parameter for Neocities API integration
341 const sitename = url.searchParams.get("sitename");
342
345 console.log(`Sitename parameter: ${sitename || "none"}`);
346
347 // If using sitename parameter, fetch from Neocities API
348 if (sitename) {
349 // Create the database key using sitename.neocities.org format
350 const dbKey = `${sitename}.neocities.org`;
351
352 // Fetch stats from Neocities API
353 const neocitiesData = await fetchNeocitiesStats(sitename);
354
356 const count = await getCount(dbKey);
357
358 // If API fetch successful, update the database
359 if (neocitiesData && neocitiesData.result === "success") {
360 // Extract the hits value
198 const fetchSongs = async () => {
199 try {
200 const response = await fetch("/api/songs");
201 if (!response.ok) throw new Error("Failed to fetch songs");
202 const data = await response.json();
215 const handleAdd = async (song: Omit<Song, "id" | "created_at">) => {
216 try {
217 const response = await fetch("/api/songs", {
218 method: "POST",
219 headers: { "Content-Type": "application/json" },
229 const handleEdit = async (song: Song) => {
230 try {
231 const response = await fetch(`/api/songs/${song.id}`, {
232 method: "PUT",
233 headers: { "Content-Type": "application/json" },
243 const handleDelete = async (id: string) => {
244 try {
245 const response = await fetch(`/api/songs/${id}`, {
246 method: "DELETE",
247 });
354 const url = new URL(req.url);
355
356 // API endpoints
357 if (url.pathname === "/api/songs") {
358 if (req.method === "GET") {
359 const result = await sqlite.execute(
376 }
377
378 if (url.pathname.startsWith("/api/songs/")) {
379 const id = url.pathname.split("/").pop();
380
402 <title>Music Player</title>
403 <meta name="viewport" content="width=device-width, initial-scale=1">
404 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
405 <style>${css}</style>
406 </head>
11 },
12 {
13 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
14 "title": "Weather App",
15 "code": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>NYC Weather</title>\n <link href=\"https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css\" rel=\"stylesheet\">\n <style>\n .weather-icon {\n font-size: 48px;\n margin-bottom: 16px;\n }\n </style>\n</head>\n<body class=\"h-screen bg-blue-100 flex justify-center items-center p-4\">\n <div class=\"bg-white p-8 rounded-md shadow-md w-full max-w-sm md:p-12 lg:p-16 xl:p-20\">\n <h1 class=\"text-2xl font-bold mb-4 text-center text-blue-500\">NYC Weather</h1>\n <div id=\"weather\" class=\"mb-4 p-4 text-center\">\n <div id=\"temperature\" class=\"text-4xl font-bold mb-4\"></div>\n <div id=\"condition\" class=\"text-xl font-medium mb-4\"></div>\n <div id=\"humidity\" class=\"text-lg font-light mb-2\">Humidity: <span id=\"humidity-value\"></span>%</div>\n <div id=\"wind\" class=\"text-lg font-light mb-2\">Wind: <span id=\"wind-value\"></span> mph</div>\n <i id=\"weather-icon\" class=\"weather-icon text-blue-500\"></i>\n </div>\n </div>\n <p class=\"fixed bottom-0 left-0 right-0 text-center p-4 text-gray-600 md:p-6 lg:p-8 xl:p-10\">\n Built on <a class=\"text-blue-600\" href=\"https://cerebrascoder.com\">Cerebras Coder</a>\n </p>\n\n <script>\n // Sample weather data\n const weatherData = {\n temperature: 75,\n condition: 'Sunny',\n humidity: 60,\n wind: 10,\n icon: 'sun'\n };\n\n document.getElementById('temperature').innerText = `${weatherData.temperature}°F`;\n document.getElementById('condition').innerText = weatherData.condition;\n document.getElementById('humidity-value').innerText = weatherData.humidity;\n document.getElementById('wind-value').innerText = weatherData.wind;\n\n // Map weather icon\n const weatherIcons = {\n 'sun': '☀',\n 'cloud': '☀',\n 'rain': '☃',\n 'snow': '☄'\n };\n\n document.getElementById('weather-icon').innerHTML = weatherIcons[weatherData.icon] || '';\n </script>\n</body>\n</html>",