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/?q=function&page=1601&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 18955 results for "function"(2254ms)

semanticSearchBlogPostPlotmain.tsx1 match

@janpaul123•Updated 10 months ago
1import blogPostEmbeddingsDimensionalityReduction from "https://esm.town/v/janpaul123/blogPostEmbeddingsDimensionalityReduction";
2
3export async function semanticSearchBlogPostPlot() {
4 const Plot = await import("https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.14/+esm");
5 const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm");
9import OpenAI from "npm:openai";
10
11export default async function blogPostEmbeddingsDimensionalityReduction() {
12 const points = [
13 "animal that barks",
24
25 const openai = new OpenAI();
26 async function getEmbedding(str) {
27 return (await openai.embeddings.create({
28 model: "text-embedding-3-large",

compareEmbeddingsmain.tsx1 match

@janpaul123•Updated 10 months ago
22const openai = new OpenAI();
23const cache = {};
24async function getEmbedding(str) {
25 cache[str] = cache[str] || (await openai.embeddings.create({
26 model: "text-embedding-3-large",

faucetsmain.tsx1 match

@git•Updated 10 months ago
1export default async function(req: Request): Promise<Response> {
2 return new Response(
3 JSON.stringify(

formLogicmain.tsx4 matches

@iamseeley•Updated 10 months ago
16const promptKey = 'imagePromptValue';
17
18export function updateForm() {
19 const model = document.getElementById('model').value;
20 const modelParams = document.getElementById('modelParams');
41}
42
43export async function handleFormSubmit(event) {
44 event.preventDefault();
45
131}
132
133function handleImageResponse(data, imageSize, model) {
134 const resultDiv = document.getElementById('result');
135
159}
160
161export function handleReset() {
162 const resultDiv = document.getElementById('result');
163 if (resultDiv) {

indexValsBlobsmain.tsx1 match

@janpaul123•Updated 10 months ago
17const existingEmbeddingsIds = new Set(Object.keys(allValsBlobEmbeddingsMeta));
18
19function idForVal(val: any): string {
20 return `${val.author_username}!!${val.name}!!${val.version}`;
21}

valtownsemanticsearchmain.tsx2 matches

@janpaul123•Updated 10 months ago
8const githubQuery = (query: string) => encodeURIComponent(`${query} repo:pomdtr/val-town-mirror path:vals/`);
9
10async function handler(req: Request) {
11 const url = new URL(req.url);
12
30 }
31
32 function form(query, type) {
33 return (
34 <form method="GET" action="/search">

semanticSearchNeonmain.tsx1 match

@janpaul123•Updated 10 months ago
7const dimensions = 1536;
8
9export default async function semanticSearchPublicVals(query) {
10 const client = new Client(Deno.env.get("NEON_URL_VALSEMBEDDINGS"));
11 await client.connect();

indexValsNeonmain.tsx2 matches

@janpaul123•Updated 10 months ago
10// CREATE TABLE vals_embeddings (id TEXT PRIMARY KEY, embedding VECTOR(1536));
11
12export default async function() {
13 const dimensions = 1536;
14
24 );
25
26 function idForVal(val: any): string {
27 return `${val.author_username}!!${val.name}!!${val.version}`;
28 }

getValCodemain.tsx1 match

@janpaul123•Updated 10 months ago
1import { db as allValsDb } from "https://esm.town/v/sqlite/db?v=9";
2
3export default async function getValCode(val) {
4 let code = undefined;
5 for (let attempt = 1; true; attempt++) {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",