linkInBioTemplatemain.tsx1 match
174<title>Side School Seminar</title>
175<meta name="viewport" content="width=device-width, initial-scale=1">
176<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
177<style>${css}</style>
178</head>
weeksummarymain.tsx3 matches
37prev => [...prev, `Fetching scraps and generating summary for week of ${weekStart.toDateString()}...`],
38);
39const response = await fetch(`/api/summary?week=${weekStart.toISOString()}`);
40const data = await response.json();
41120<footer className="mt-8 text-center text-sm">
121<h3>curl</h3>
122<pre class="bg-black text-white text-sm font-mono">curl 'https://ejfox-weeksummary.web.val.run/api/summary?week=2024-06-16T00:00:00.000Z'</pre>
123
124<a
146const url = new URL(request.url);
147148if (url.pathname === "/api/summary") {
149const { OpenAI } = await import("https://esm.town/v/std/openai");
150const openai = new OpenAI();
211Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
212Start your response with a comment explaining how your approach will work, what libraries or
213API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
214the simplest way to achieve the goal, though you can add some inline comments to explain your
215reasoning (not for every line, but for major groups of lines). Don't use any environment variables
216unless strictly necessary, for example use APIs that don't require a key, prefer internal function
217imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
218functions where possible. Unless specified, don't add error handling,
219make sure that errors bubble up to the caller.
220Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
221not practical for the user's request (e.g. if they ask for a particular animated gif).
222If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
223explicitly specified otherwise. Use the current val name for the storage key, which you can get
224using the "pomdtr/extractValInfo" val, which you can call like this:
273Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
274Add comments at the top of the file explaining how your approach works, what libraries or
275API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
276the simplest way to achieve the goal, though you can add some inline comments to explain your
277reasoning (not for every line, but for major groups of lines). Don't use any environment variables
278unless strictly necessary, for example use APIs that don't require a key, prefer internal function
279imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
280functions where possible. Unless specified, don't add error handling,
281make sure that errors bubble up to the caller.
282Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
283not practical for the user's request (e.g. if they ask for a particular animated gif).
284If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
285explicitly specified otherwise. Use the current val name for the storage key, which you can get
286using the "pomdtr/extractValInfo" val, which you can call like this:
389\`\`\`
390
391### Lower-level API
392
393We do provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level.
394
395- \`async get(key: string)\`: Retrieves a blob for a given key.
396- \`async set(key: string, value: string | BodyInit)\`: Sets the blob value for a given key. See [BodyInit](https://deno.land/api@v1.38.1?s=BodyInit).
397
398### Limitations
12041205const tempValName = `valle_tmp_${Math.random() * 10}`.replaceAll(".", "");
1206// Errors in running the val bubble up through this API, so ignore them.
1207await vt.vals.create({ name: tempValName, code: newCode, type: "http" as any, privacy: "unlisted" }).catch(
1208(error) => {
slackScoutREADME.md4 matches
7## Getting Started
8To run Slack Scout, you’ll need a
9- Browserbase API key
10- Slack Webhook URL: setup [here](https://docs.val.town/integrations/slack/send-messages-to-slack/)
11- Twitter Developer API key
1213### Browserbase
192021We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. _If you decide to use Browserbase, we can lend our token. Comment below for access._
2223Once you have the `SLACK_WEBHOOK_URL`, `BROWSERBASE_API_KEY`, and `TWITTER_BEARER_TOKEN`, input all of these as [Val Town Environment Variables](https://www.val.town/settings/environment-variables).
2425---
githubGistsmain.tsx1 match
3// GitHub gists
4export let githubGists = fetchJSON(
5"https://api.github.com/users/stevekrouse/gists",
6);
7
nasaImageDetailsmain.tsx1 match
23export const nasaImageDetails = async () => {
4const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5let nasaImageHtml = nasaAPOD.hdurl
6? `<img width="100%" src="${nasaAPOD.hdurl}"/>`
1/**
2* This val creates a website called TownGen that generates optimized prompts for Hono and Deno based on user input.
3* It uses a simulated API for Hono and Deno features and incorporates a loading animation.
4* The prompt is tested and debugged using a simulated API before presenting to the user.
5* It includes a pill box multi-select for enhanced features from npm packages, organized into categories.
6* A large submit button and a 10-second animation are added when generating the prompt.
16import { createRoot } from "https://esm.sh/react-dom/client";
1718// Simulated API for Hono and Deno features
19const features = {
20hono: [
34"Built-in testing",
35"Permissions system",
36"Web standard APIs",
37],
38};
45backend: {
46icon: "🖧",
47items: ["GraphQL", "RESTful API", "WebSockets", "gRPC", "Microservices", "Serverless", "Event-driven"],
48},
49database: {
201content: [
202"contentful",
203"strapi",
204"ghost",
205"markdown-it",
262"Add splash page",
263"Add excessive emojis",
264"Use Web Storage API for local data",
265"Add a cookie consent banner",
266"Implement a progress bar for long forms",
3043. Leverage Deno capabilities:
305${features.deno.map(feature => `- ${feature}`).join("\n ")}
3064. Implement RESTful API endpoints
3075. Add error handling and logging
3086. Include unit tests using Deno's built-in testing framework
318Please generate TypeScript code for a Hono application running on Deno that implements these features.`;
319320// Simulated API call for testing and debugging
321const debuggedPrompt = await simulateDebugAPI(generatedPrompt);
322323setPrompt(debuggedPrompt);
333"Add database integration",
334"Implement authentication system",
335"Set up API endpoints",
336"Add error handling and logging",
337"Implement unit tests",
347"User authentication and authorization",
348"Data persistence and retrieval",
349"API integration",
350"Error handling and logging",
351"Performance optimization",
359};
360361const simulateDebugAPI = async (prompt: string) => {
362// Simulated API call for testing and debugging
363await new Promise(resolve => setTimeout(resolve, 2000));
364return prompt + "\n\nNote: This prompt has been tested and debugged for Hono and Deno compatibility.";
533<meta name="viewport" content="width=device-width, initial-scale=1.0">
534<title>TownGen - Val Generator</title>
535<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
536<style>${css}</style>
537</head>
1/**
2* This val creates a website called TownGen that generates optimized prompts for Hono and Deno based on user input.
3* It uses a simulated API for Hono and Deno features and incorporates a loading animation.
4* The prompt is tested and debugged using a simulated API before presenting to the user.
5* It includes a pill box multi-select for enhanced features from npm packages, organized into categories.
6* A large submit button and a 10-second animation are added when generating the prompt.
16import { createRoot } from "https://esm.sh/react-dom/client";
1718// Simulated API for Hono and Deno features
19const features = {
20hono: [
34"Built-in testing",
35"Permissions system",
36"Web standard APIs",
37],
38};
45backend: {
46icon: "🖧",
47items: ["GraphQL", "RESTful API", "WebSockets", "gRPC", "Microservices", "Serverless", "Event-driven"],
48},
49database: {
201content: [
202"contentful",
203"strapi",
204"ghost",
205"markdown-it",
262"Add splash page",
263"Add excessive emojis",
264"Use Web Storage API for local data",
265"Add a cookie consent banner",
266"Implement a progress bar for long forms",
3043. Leverage Deno capabilities:
305${features.deno.map(feature => `- ${feature}`).join("\n ")}
3064. Implement RESTful API endpoints
3075. Add error handling and logging
3086. Include unit tests using Deno's built-in testing framework
318Please generate TypeScript code for a Hono application running on Deno that implements these features.`;
319320// Simulated API call for testing and debugging
321const debuggedPrompt = await simulateDebugAPI(generatedPrompt);
322323setPrompt(debuggedPrompt);
333"Add database integration",
334"Implement authentication system",
335"Set up API endpoints",
336"Add error handling and logging",
337"Implement unit tests",
347"User authentication and authorization",
348"Data persistence and retrieval",
349"API integration",
350"Error handling and logging",
351"Performance optimization",
359};
360361const simulateDebugAPI = async (prompt: string) => {
362// Simulated API call for testing and debugging
363await new Promise(resolve => setTimeout(resolve, 2000));
364return prompt + "\n\nNote: This prompt has been tested and debugged for Hono and Deno compatibility.";
533<meta name="viewport" content="width=device-width, initial-scale=1.0">
534<title>TownGen - Val Generator</title>
535<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
536<style>${css}</style>
537</head>
1/**
2* This val creates a website that generates optimized prompts for Val Town based on user input.
3* It uses the OpenAI API to generate prompts and incorporates a loading animation.
4* The generated prompt is tailored to Val Town's specific features and best practices.
5*/
18"TypeScript support",
19"Deno runtime",
20"Web APIs",
21];
22
valleBlogV0README.md1 match
1* Fork this val to your own profile.
2* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.
3