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=1705&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 17935 results for "function"(1249ms)

commentsmain.tsx1 match

@andreterron•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export function comments({ token, since, until, offset, limit, relationship }: {
5 token: string;
6 since?: Date;

dallemailmain.tsx1 match

@andreterron•Updated 1 year ago
4import { dalleImageUrl } from "https://esm.town/v/andreterron/dalleImageUrl";
5
6export async function dallemail(email) {
7 let imageUrl = await dalleImageUrl(email.text);
8 return email2({

actuallyItsXBotmain.tsx1 match

@andreterron•Updated 1 year ago
4import { refreshActuallyBotToken } from "https://esm.town/v/andreterron/refreshActuallyBotToken";
5
6export async function actuallyItsXBot() {
7 const token = await refreshActuallyBotToken();
8 //

feedGeneratormain.tsx2 matches

@lukas•Updated 1 year ago
29 cursor?: string;
30}
31export async function feedGenerator({ feed, serviceDID, publisherDID, hostname }: {
32 serviceDID?: string;
33 publisherDID: string;
57 return [q.toString()];
58 };
59 return async function (req: express.Request, res: express.Response) {
60 const serviceDid = serviceDID ?? `did:web:${hostname}`;
61 const didCache = new resolver.MemoryCache();

myApimain.tsx1 match

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

chatSampleFunctionMultiplemain.tsx7 matches

@webup•Updated 1 year ago
2import { chat } from "https://esm.town/v/webup/chat";
3
4export const chatSampleFunctionMultiple = (async () => {
5 // Helper function to call and print assistant response
6 const callAssistant = async (messages) => {
7 const response = await chat(messages, {
8 functions: schemasWeather,
9 });
10 typeof response === "object"
18 role: "system",
19 content:
20 "Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.",
21 },
22 { role: "user", content: "What's the weather like today" },
23 ];
24 let response = await callAssistant(messages);
25 // Once we provide the missing info, it will generate the appropriate function arguments
26 messages.push({ role: "assistant", content: response });
27 messages.push({ role: "user", content: "I'm in Glasgow, Scotland." });
28 response = await callAssistant(messages);
29 // By prompting it differently, we can get it to target the other function we've told
30 messages.length = 1;
31 messages.push({
35 });
36 response = await callAssistant(messages);
37 // Let's provide the num of days, and model will generate the call to the other function
38 messages.push({ role: "assistant", content: response });
39 messages.push({ role: "user", content: "5 days" });

greetmain.tsx1 match

@tmalaher•Updated 1 year ago
1export function greet(name: string) {
2 name = name || "world";
3 return "Hello, " + name + "!";

blogRSSTrackermain.tsx1 match

@ianvph•Updated 1 year ago
7import { parseXML } from "https://esm.town/v/stevekrouse/parseXML?v=1";
8
9export async function blogRSSTracker() {
10 // gets newest blog from rss feed
11 const blogRSSLink = "https://posthog.com/rss.xml";

myApimain.tsx1 match

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

gtp3main.tsx1 match

@mgsers•Updated 1 year ago
1import { runVal } from "https://esm.town/v/std/runVal";
2
3export async function gtp3(prompt) {
4 return await runVal("patrickjm.gpt3", {
5 prompt,

getFileEmail4 file matches

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

tuna8 file matches

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