20// Example database operation
21await sqlite.execute(`
22 SELECT * FROM apps WHERE api_key = ?
23`, [apiKey]);
24```
25
26### HTTP Vals
27- HTTP vals provide public API endpoints
28- Format: Takes a Request object and returns a Response object
29- URLs are automatically provisioned at username.web.val.run
83The project leverages Val Town Projects structure for organization:
84
851. **Main Export Val**: Top-level `index.ts` exports all public APIs
862. **Module Organization**: Logical grouping of files by functionality (db, api, ui, etc.)
873. **Shared Utilities**: Common code factored into utility modules
884. **Import System**: Using relative imports within the project
13 id INTEGER PRIMARY KEY AUTOINCREMENT,
14 name TEXT NOT NULL,
15 api_key TEXT NOT NULL UNIQUE,
16 description TEXT,
17 created_at TEXT DEFAULT (DATETIME('now'))
43## Implementation Notes
44
45- All database operations are performed through Val Town's `std/sqlite` API
46- Schema includes proper constraints:
47 - Primary keys for uniquely identifying records
55// Example of safe parameterized query
56const app = await sqlite.execute(
57 `SELECT * FROM apps WHERE api_key = ?`,
58 [apiKey]
59);
60```
12 useEffect(() => {
13 fetchComments();
14 // Check if Web Share API is supported
15 setIsShareSupported("share" in navigator);
16 }, []);
43 const emailContent = `From: ${name} (${email})\n\nBatch Price: ${comment}\n\nTo: studypoormail@gmail.com`;
44
45 // Use Web Share API to automatically open Gmail
46 if (isShareSupported) {
47 try {
61 }
62 } else {
63 // Fallback for browsers not supporting Web Share API
64 window.location.href = `mailto:studypoormail@gmail.com?subject=Batch%20Price%20Submitted&body=${
65 encodeURIComponent(emailContent)
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":
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`
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,
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
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: [
78 <script>
79 // Replace these with your actual Valtown endpoints
80 const API_BASE = 'https://YOUR_USERNAME.val.run';
81 const GET_ENDPOINT = `${API_BASE}/getExploredNeighborhoods`;
82 const UPDATE_ENDPOINT = `${API_BASE}/updateExploredNeighborhoods`;
83
84 // Map setup
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
61 console.error("LINEAR_API_KEY not found in environment variables");
62 Deno.exit(1);
63 }
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
70 "Content-Type": "application/json",
71 Authorization: apiKey,
72 },
73 body: JSON.stringify({
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
99 "Content-Type": "application/json",
100 Authorization: apiKey,
101 },
102 body: JSON.stringify({
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {