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%22Optional%20title%22?q=function&page=1760&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 20331 results for "function"(2809ms)

key_safe_linkmain.tsx1 match

@stevekrouse•Updated 11 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

favFarmmain.tsx1 match

@stevekrouse•Updated 11 months ago
81 dangerouslySetInnerHTML={{
82 __html: `
83 function copyToClipboard(codeEl) {
84 navigator.clipboard.writeText(codeEl.innerText);
85 codeEl.classList.add('hl');

weatherGPTmain.tsx1 match

@jcoleman•Updated 11 months ago
38console.log(text);
39
40export async function weatherGPT() {
41 await email({ subject: "Weather Today", text });
42}

preactExamplemain.tsx2 matches

@tfayyaz•Updated 11 months ago
3import { render } from "npm:preact-render-to-string";
4
5function Car(props) {
6 return <h2>Hi, I am a {props.color} component Car!</h2>;
7}
8
9function Garage() {
10 return (
11 <>

aiImageExamplemain.tsx3 matches

@yawnxyz•Updated 11 months ago
2import { z } from "npm:zod";
3
4// Function to handle image and text input using OpenAI's GPT-4-turbo
5async function handleImageChat() {
6 const initialMessages = [
7 { role: "system", content: "You are a helpful assistant." },
30}
31
32// Run the function
33await handleImageChat();
34

easyAQImain.tsx1 match

@stevekrouse•Updated 11 months ago
7const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
8
9export async function easyAQI({ location }: {
10 location: string;
11}) {

easyAQI_cachedmain.tsx1 match

@stevekrouse•Updated 11 months ago
7const cacheKey = location => "easyAQI_locationID_cache_" + encodeURIComponent(location);
8
9export async function easyAQI({ location }: {
10 location: string;
11}) {

valTownAnalyticsmain.tsx1 match

@maxm•Updated 11 months ago
94};
95
96async function handler(req: Request): Promise<Response> {
97 const url = new URL(req.url);
98 if (req.method === "GET" && url.pathname === "/event") {

weatherGPTmain.tsx1 match

@developersdigest•Updated 11 months ago
31console.log(text);
32
33export async function weatherGPT() {
34 await email({ subject: "Weather Today", text });
35}

semanticSearchBlobsmain.tsx1 match

@janpaul123•Updated 11 months ago
10const dimensions = 1536;
11
12export default async function semanticSearchPublicVals(query) {
13 const allValsBlobEmbeddingsMeta = (await blob.getJSON(`allValsBlob${dimensions}EmbeddingsMeta`)) ?? {};
14 const allBatchDataIndexes = _.uniq(Object.values(allValsBlobEmbeddingsMeta).map((item: any) => item.batchDataIndex));

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.