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/$1?q=function&page=35&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 29111 results for "function"(1071ms)

TownieMessages.tsx9 matches

@valdottown•Updated 1 day ago
23});
24
25export function Messages ({
26 messages,
27 messageEndTimes,
58}
59
60function Message ({
61 message,
62 messageEndTimes,
86}
87
88function AssistantMessage ({ message, messageEndTimes, running }: {
89 message: Message;
90 messageEndTimes: Record<string, number>;
107}
108
109function Part ({ part }) {
110 switch (part.type) {
111 case "text":
122}
123
124function TextPart ({ part }) {
125 return (
126 <ReactMarkdown>
130}
131
132function Details ({ open, onClick, children, summary }) {
133 return (
134 <details
148}
149
150function ToolPart ({ part }) {
151 const { openSummaries, setOpenSummaries } = useContext(MessageContext);
152 const {
312}
313
314function EditorToolPart ({ part }) {
315 const { openSummaries, setOpenSummaries } = useContext(MessageContext);
316 const {
379}
380
381function UserMessage ({ message }: {
382 message: Message;
383}) {

parquetduckdb.html4 matches

@maxm•Updated 1 day ago
114
115 // Sanitize error messages to remove any sensitive information
116 function sanitizeErrorMessage(message) {
117 if (!message) return "Unknown error";
118
125 }
126
127 function addQuery(id, sql) {
128 const container = document.createElement('div');
129 container.className = 'query';
146 }
147
148 function showTable(el, columns, rows) {
149 if (rows.length === 0) {
150 el.innerHTML = '<span class="success">No results</span>';
171 }
172
173 (async function() {
174 try {
175 // Initialize DuckDB

boggleSolverTowniemain.tsx5 matches

@alexwein•Updated 1 day ago
16}
17
18function buildTrie(words: string[]): TrieNode {
19 const root = new TrieNode();
20 for (const word of words) {
31}
32
33function findBoggleWords(board: { x: number; y: number; letter: string }[], wordList: string[]): string[] {
34 const trie = buildTrie(wordList);
35 const foundWords = new Set<string>();
49 ];
50
51 function isValidCell(x: number, y: number): boolean {
52 return x >= 0 && x < cols && y >= 0 && y < rows;
53 }
54
55 function dfs(x: number, y: number, node: TrieNode, visited: Set<string>, currentWord: string) {
56 // Out of bounds or already visited cell
57 const cellKey = `${x},${y}`;
93}
94
95export default function boggleSolver(
96 board: { x: number; y: number; letter: string }[],
97 wordList: string[] = wordListCache || [],

parquetApp.tsx1 match

@maxm•Updated 1 day ago
3import { Chat } from "./Chat.tsx";
4
5export function App() {
6 return (
7 <div className="app-container">

parquetpages.html1 match

@maxm•Updated 1 day ago
110 const pages = __PAGES_DATA__;
111
112 function renderPages() {
113 const pagesListElement = document.getElementById('pagesList');
114

ApiifyApp.tsx1 match

@wolf•Updated 1 day ago
31}
32
33export function App() {
34 const [url, setUrl] = useState("");
35 const [maxPages, setMaxPages] = useState(5);

Apiifysdk.ts1 match

@wolf•Updated 1 day ago
10 * @returns The newly created val or throws an error
11 */
12export async function forkVal(valId: string, newValName: string) {
13 const projectDetails = await sdk.vals.retrieve(valId);
14

Apiifyinputer.ts14 matches

@wolf•Updated 1 day ago
17 }
18
19 public async generateQueryFunction() {
20 const page = await this.browser.newPage();
21 await page.goto(this.page);
47 console.log("Element info:", elementInfo);
48
49 const { object: generatedFunction } = await generateObject({
50 model: google("gemini-1.5-pro"),
51 schema: z.object({
52 functionCode: z.string().describe(
53 "JavaScript function code that will interact with the element",
54 ),
55 inputArgSchema: z.string().describe(
56 "JSON schema for the input data that the function expects",
57 ),
58 }),
59 prompt: `
60 You are a specialized automation engineer. Your task is to create a JavaScript function that will
61 interact with a specific element on a webpage.
62
66
67 # REQUIREMENTS
68 Create an async JavaScript function that:
69 1. Takes two parameters: 'page' (a Puppeteer Page object) and 'inputData' (an object containing input values)
70 2. Uses the element's data-element-id attribute to find and interact with the element
74
75 # IMPORTANT NOTES
76 - The function should work with Puppeteer's Page API
77 - Find the element using: page.$('[data-element-id="${this.elementId}"]')
78 - Use page.waitForSelector() for waiting
85 # EXAMPLE FORMAT (adapt based on the actual element type):
86 \`\`\`javascript
87 async function(page, inputData) {
88 try {
89 // Find the element by its data attribute
112 \`\`\`
113
114 Generate ONLY the function body code that would be used between the function() { } brackets.
115 Make it as specific as possible to this particular element and its behavior.
116 IMPORTANT: Use the data-element-id attribute approach shown in the example with Puppeteer syntax.
119
120 return {
121 code: generatedFunction.functionCode,
122 inputSchema: generatedFunction.inputArgSchema,
123 };
124 }
125}
126
127export async function generateQueryFunction(
128 browser: Browser,
129 elementId: string,
132 return await Inputer
133 .of(browser, elementId, page)
134 .generateQueryFunction();
135}
136

Apiifywebsite-analyzer.ts3 matches

@wolf•Updated 1 day ago
130 schema: z.object({
131 mainClass: z.string().describe("Main automation class code"),
132 helperFunctions: z.string().describe("Helper functions for element interactions"),
133 usageExamples: z.string().describe("Example usage code"),
134 documentation: z.string().describe("Documentation explaining how to use the generated code"),
180${codeGeneration.mainClass}
181
182${codeGeneration.helperFunctions}
183
184// Usage Examples:
217}
218
219export async function analyzeWebsite(
220 startUrl: string,
221 browser: Browser,

Apiifyelements.ts1 match

@wolf•Updated 1 day ago
101}
102
103export async function getAllGoodElements(url: string, browser: Browser) {
104 const scraper = Scraper.of(url, browser);
105 return await scraper.findUsefulElements();
tuna

tuna9 file matches

@jxnblk•Updated 1 day ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.