Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Image%20title%22?q=function&page=69&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 33110 results for "function"(4397ms)

1Given <knowledge>, add a section that describes <newFunctionality> with an example.
2
3<newFunctionality>
4 Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
5
6```tsx
7export async function getIssueContentAsMarkdown(
8 issueNumber: number,
9 options: MonitorOptions = {},
67 return markdown;
68}```
69</newFunctionality>
70
71
76
77- Ask clarifying questions when requirements are ambiguous
78- Provide complete, functional solutions rather than skeleton implementations
79- Test your logic against edge cases before presenting the final solution
80- Ensure all code follows Val Town's specific platform requirements
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
91- Follow modern ES6+ conventions and functional programming practices if possible
92
93## Types of triggers
100
101```ts
102export default async function (req: Request) {
103 return new Response("Hello World");
104}
114
115```ts
116export default async function () {
117 // Scheduled task code
118}
128
129```ts
130export default async function (email: Email) {
131 // Process email
132}
138## Val Town Standard Libraries
139
140Val Town provides several hosted services and utility functions.
141
142### Blob Storage
192```
193
194## Val Town Utility Functions
195
196Val Town provides several utility functions to help with common project tasks.
197
198### Importing Utilities
272โ”‚ โ”œโ”€โ”€ database/
273โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
274โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
275โ”‚ โ”‚ โ””โ”€โ”€ README.md
276โ”‚ โ””โ”€โ”€ routes/ # Route modules
291โ””โ”€โ”€ shared/
292 โ”œโ”€โ”€ README.md
293 โ””โ”€โ”€ utils.ts # Shared types and functions
294```
295
298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
301 ```ts
302 import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
332- Run migrations on startup or comment out for performance
333- Change table names when modifying schemas rather than altering
334- Export clear query functions with proper TypeScript typing
335
336## Common Gotchas and Solutions
362
363
364## Utility Functions from Other Vals
365
366### Logging
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370
371# Next Step 1 - Export a new function from api
372
373The new function should return the relevant content of a given issue in markdown format.
374The relevant content is the text comments, including URLs (of links and images) included in them.
375

github-apillm19 matches

@cricks_unmixed4uโ€ขUpdated 5 days ago
1Given <knowledge>, add a section that describes <newFunctionality> with an example.
2
3<newFunctionality>
4 Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
5
6```tsx
7export async function getIssueContentAsMarkdown(
8 issueNumber: number,
9 options: MonitorOptions = {},
67 return markdown;
68}```
69</newFunctionality>
70
71
76
77- Ask clarifying questions when requirements are ambiguous
78- Provide complete, functional solutions rather than skeleton implementations
79- Test your logic against edge cases before presenting the final solution
80- Ensure all code follows Val Town's specific platform requirements
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
91- Follow modern ES6+ conventions and functional programming practices if possible
92
93## Types of triggers
100
101```ts
102export default async function (req: Request) {
103 return new Response("Hello World");
104}
114
115```ts
116export default async function () {
117 // Scheduled task code
118}
128
129```ts
130export default async function (email: Email) {
131 // Process email
132}
138## Val Town Standard Libraries
139
140Val Town provides several hosted services and utility functions.
141
142### Blob Storage
192```
193
194## Val Town Utility Functions
195
196Val Town provides several utility functions to help with common project tasks.
197
198### Importing Utilities
272โ”‚ โ”œโ”€โ”€ database/
273โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
274โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
275โ”‚ โ”‚ โ””โ”€โ”€ README.md
276โ”‚ โ””โ”€โ”€ routes/ # Route modules
291โ””โ”€โ”€ shared/
292 โ”œโ”€โ”€ README.md
293 โ””โ”€โ”€ utils.ts # Shared types and functions
294```
295
298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
301 ```ts
302 import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
332- Run migrations on startup or comment out for performance
333- Change table names when modifying schemas rather than altering
334- Export clear query functions with proper TypeScript typing
335
336## Common Gotchas and Solutions
362
363
364## Utility Functions from Other Vals
365
366### Logging
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370
371# Next Step 1 - Export a new function from api
372
373The new function should return the relevant content of a given issue in markdown format.
374The relevant content is the text comments, including URLs (of links and images) included in them.
375

github-apiindex.tsx2 matches

@cricks_unmixed4uโ€ขUpdated 5 days ago
22export interface MonitorOptions extends GitHubConfig {}
23
24export async function getGitHubIssuesUpdatedSinceLastRun(
25 options: MonitorOptions = {},
26) {
78}
79
80export async function getIssueContentAsMarkdown(
81 issueNumber: number,
82 options: MonitorOptions = {},

github-apigithub-utils.ts2 matches

@cricks_unmixed4uโ€ขUpdated 5 days ago
13}
14
15export function createGitHubClient(options: GitHubConfig = {}): GitHubClientResult {
16 // Configuration with fallbacks to environment variables
17 const repoOwner = options.repoOwner || Deno.env.get("GITHUB_REPO_OWNER");
43}
44
45export function extractUrls(text: string): string[] {
46 const urlRegex = /(https?:\/\/[^\s\)]+)/g;
47 return text.match(urlRegex) || [];
5
6// Debug logger
7export function debugLog(...args: unknown[]) {
8 if (Deno.env.get("DEBUG") === "true") {
9 console.log("[DEBUG]", ...args);
13export { getGitHubIssuesUpdatedSinceLastRun }; // Backwards compatibility related to rolodex.
14
15export async function monitorGitHubIssues(options: MonitorOptions = {}) {
16 try {
17 debugLog("Starting monitorGitHubIssues with options:", options);
38}
39
40// Keep the default export for cron functionality
41export default monitorGitHubIssues;
42

sandboxescloudflare-worker-edit.tsx1 match

@chadparkerโ€ขUpdated 5 days ago
1export default async function (req: Request): Promise<Response> {
2 try {
3 // Get credentials from environment variables

gissue-rolodexmain.cron.tsx1 match

@cricks_unmixed4uโ€ขUpdated 5 days ago
16const DAILY_TRACKING_TABLE = "beeminder_issue_daily_sends_2";
17
18export default async function () {
19 console.log("๐Ÿš€ Starting GitHub Issue Rolodex...");
20

gissue-rolodexknowledge.md12 matches

@cricks_unmixed4uโ€ขUpdated 5 days ago
4
5- Ask clarifying questions when requirements are ambiguous
6- Provide complete, functional solutions rather than skeleton implementations
7- Test your logic against edge cases before presenting the final solution
8- Ensure all code follows Val Town's specific platform requirements
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
19- Follow modern ES6+ conventions and functional programming practices if possible
20
21## Types of triggers
28
29```ts
30export default async function (req: Request) {
31 return new Response("Hello World");
32}
42
43```ts
44export default async function () {
45 // Scheduled task code
46}
56
57```ts
58export default async function (email: Email) {
59 // Process email
60}
66## Val Town Standard Libraries
67
68Val Town provides several hosted services and utility functions.
69
70### Blob Storage
120```
121
122## Val Town Utility Functions
123
124Val Town provides several utility functions to help with common project tasks.
125
126### Importing Utilities
200โ”‚ โ”œโ”€โ”€ database/
201โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Schema definitions
202โ”‚ โ”‚ โ”œโ”€โ”€ queries.ts # DB query functions
203โ”‚ โ”‚ โ””โ”€โ”€ README.md
204โ”‚ โ””โ”€โ”€ routes/ # Route modules
219โ””โ”€โ”€ shared/
220 โ”œโ”€โ”€ README.md
221 โ””โ”€โ”€ utils.ts # Shared types and functions
222```
223
226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
229 ```ts
230 import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
262- Export clear query functions with proper TypeScript typing
263
264## Common Gotchas and Solutions

sandboxestogether-sandbox.tsx1 match

@chadparkerโ€ขUpdated 5 days ago
2import { CodeSandbox } from "npm:@codesandbox/sdk@1.1.6";
3
4export default async function(req: Request): Promise<Response> {
5 try {
6 // Get the API key from environment variables

gissue-rolodexApp.tsx1 match

@cricks_unmixed4uโ€ขUpdated 5 days ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export default function App(): React.JSX.Element {
5 const [refreshFrequency, setRefreshFrequency] = useState("");
6 const [isSubmitting, setIsSubmitting] = useState(false);

discordWebhook2 file matches

@stevekrouseโ€ขUpdated 3 days ago
Helper function to send Discord messages
tuna

tuna9 file matches

@jxnblkโ€ขUpdated 4 weeks ago
Simple functional CSS library for Val Town
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.