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=1495&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 17289 results for "function"(1082ms)

fetchRssmain.tsx1 match

@svoisen•Updated 1 year ago
2
3// This supports more RSS types than @stevekrouse.fetchRSS
4export async function fetchRss(url: string, lastRunDate?: string | number) {
5 let Parser = await import("npm:rss-parser");
6 let parser = new Parser.default();

azureNewtmain.tsx1 match

@suhaasy•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

valToGHmain.tsx5 matches

@nbbaier•Updated 1 year ago
4import { DateTime } from "npm:luxon";
5
6async function getLatestCommit(ghUser: string, ghRepo: string, branch: string, client: Octokit)
7{
8 const { data: refData } = await client.rest.git.getRef({
15}
16
17async function createNewTree(
18 ghUser: string,
19 ghRepo: string,
40}
41
42async function createNewCommit(
43 ghUser: string,
44 ghRepo: string,
60}
61
62async function updateBranchRef(
63 owner: string,
64 repo: string,
92 */
93
94export async function valToGH(
95 repo: string, // owner/repo
96 val: string | string[], // user/val

testmain.tsx1 match

@d•Updated 1 year ago
1export function test(){
2 return Math.random();
3}

htmlExamplemain.tsx1 match

@Llad•Updated 1 year ago
1// View at https://andreterron-htmlExample.web.val.run?name=Andre
2export default async function(req: Request): Promise<Response> {
3 const query = new URL(req.url).searchParams;
4

yellowToadmain.tsx2 matches

@simonw•Updated 1 year ago
2
3const script = `
4def mapFunction(r, i):
5 v = r * i
6 return v
8x = [1, 2, 3, 4]
9x
10 .map(mapFunction)
11 .filter(r => r * r)
12 .join(",")

jsPythonmain.tsx2 matches

@stevekrouse•Updated 1 year ago
2
3const script = `
4def mapFunction(r, i):
5 v = r * i
6 return v
8x = [1, 2, 3, 4]
9x
10 .map(mapFunction)
11 .filter(r => r * r)
12 .join(",")

jsPythonmain.tsx2 matches

@simonw•Updated 1 year ago
3 const { jsPython } = await import("npm:jspython-interpreter");
4 const script = `
5def mapFunction(r, i):
6 v = r * i
7 return v
9x = [1, 2, 3, 4]
10x
11 .map(mapFunction)
12 .filter(r => r * r)
13 .join(",")

latestBlogContentmain.tsx1 match

@simonw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function latestBlogContent() {
4 return (
5 await fetch(

btcPriceAlertmain.tsx1 match

@jain•Updated 1 year ago
4import { currency } from "https://esm.town/v/stevekrouse/currency";
5
6export async function btcPriceAlert() {
7 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
8 let btcPrice = await currency("usd", "btc");

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": "*",