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/$%7Bart_info.art.src%7D?q=function&page=1702&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 18167 results for "function"(3867ms)

tootLatestPostsmain.tsx1 match

@sebdd•Updated 1 year ago
3import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems?v=6";
4
5export async function tootLatestPosts({ lastRunAt }: Interval) {
6 return Promise.all(
7 (await newRSSItems({

wttrGetForecastmain.tsx1 match

@smalldogenergy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function wttrGetForecast({
4 location,
5 languageCode = "en",

createQuotePostmain.tsx2 matches

@canpolat•Updated 1 year ago
6import { unusedQuotes } from "https://esm.town/v/canpolat/unusedQuotes";
7
8export async function createQuotePost({ instance, communityId, auth }: {
9 instance: string;
10 communityId: number;
14 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
15 let client = new LemmyHttp(`https://${instance}`, {
16 fetchFunction: fetch,
17 });
18 const quote = unusedQuotes.pop();

dohRequestIpAddrmain.tsx1 match

@serna•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function dohRequestIpAddr(domain) {
4 let req = await fetch(`https://1.1.1.1/dns-query?name=${domain}`, {
5 headers: { "Accept": "application/dns-json" },

myApimain.tsx1 match

@easterc•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

pipeSampleLLMBindmain.tsx3 matches

@webup•Updated 1 year ago
12 const tb = await getLangSmithBuilder();
13 const tracer = await tb();
14 const functionSchema = [
15 {
16 name: "joke",
33 ];
34 const chain = prompt.pipe(model.bind({
35 functions: functionSchema,
36 function_call: { name: "joke" },
37 }));
38 return await chain.invoke({ subject: "bears" }, { callbacks: [tracer] });

Foodmain.tsx1 match

@adamgonda•Updated 1 year ago
1export function Food(x, y) {
2 return { x, y };
3}

hueRotatemain.tsx1 match

@pasquale•Updated 1 year ago
1export function hueRotate() {
2 // Generate a random number between 0 and 180
3 let randomNumber = Math.floor(Math.random() * 181);

handlermain.tsx1 match

@thesophiaxu•Updated 1 year ago
1export async function handler(req, res) {
2 console.email(JSON.stringify(req.body, null, 4), "Hello from Val.town!");
3}

parsePdfDatamain.tsx1 match

@speepo•Updated 1 year ago
1// NOT FUNCTIONAL
2// THE PDF LIBRARY PROBABLY WON'T WORK WITH THE CODE AS IT IS
3export const parsePdfData = (req: express.Request, res: express.Response) => {

getFileEmail4 file matches

@shouser•Updated 1 week 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": "*",