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/$%7Bsuccess?q=function&page=1721&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 19409 results for "function"(3718ms)

fetchNewestValsmain.tsx1 match

@vladimyr•Updated 1 year ago
36});
37
38export async function fetchNewestVals({ page = 0 } = {}) {
39 const url = new URL("https://www.val.town/newest");
40 url.searchParams.set("_data", "routes/_app.newest");

fetchValmain.tsx1 match

@vladimyr•Updated 1 year ago
24});
25
26export async function fetchVal(author: string, name: string) {
27 const prefixUrl = new URL("/v1/alias", API_URL);
28 const resp = await ky.get(`${author}/${name}`, { prefixUrl }).json();

codemirror_demomain.tsx1 match

@edjw•Updated 1 year ago
17`;
18
19export default function() {
20 return new Response(body, {
21 headers: {

add_jsdoc_actionmain.tsx2 matches

@pomdtr•Updated 1 year ago
2import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
3
4export default async function(ctx: BrowserContext) {
5 const { author, name } = ctx.params;
6
7 await askAI(`Add jsdoc comments for each exported function of the val @${author}/${name}`);
8}

list_newest_vals_actionmain.tsx1 match

@pomdtr•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=44";
3
4export default async function() {
5 const { vals } = await fetchJSON("https://www.val.town/newest?page=0&_data=routes/_app.newest");
6

amaranthYakREADME.md1 match

@stevekrouse•Updated 1 year ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query
37

ask_aiREADME.md1 match

@pomdtr•Updated 1 year ago
6import { askAI } from "https://esm.town/v/pomdtr/ask_ai";
7
8await askAI(`Add jsdoc comments for each exported function of the val @pomdtr/askAi`);
9```

OpenAImain.tsx1 match

@pomdtr•Updated 1 year ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

OpenAIREADME.md2 matches

@pomdtr•Updated 1 year ago
12const openai = new OpenAI();
13
14const functionExpression = await openai.chat.completions.create({
15 "messages": [
16 { "role": "user", "content": "Say hello in a creative way" },
20});
21
22console.log(functionExpression.choices[0].message.content);
23```

preactTestmain.tsx1 match

@neverstew•Updated 1 year ago
4 );
5 const html = htm.bind(h);
6 function Component() {
7 const [count, setCount] = useState(0);
8 const inc = () => setCount(count => count + 1);

getFileEmail4 file matches

@shouser•Updated 3 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 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.