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=1646&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 18949 results for "function"(1970ms)

ismyplaneaboeingmain.tsx5 matches

@thecurryman•Updated 1 year ago
7 const body = await response.text();
8 const $ = cheerio.load(body);
9 const boeingElements = $("h5").filter(function() {
10 return $(this).text().includes("Boeing");
11 });
12 let aircraft = [];
13 boeingElements.each(function() {
14 aircraft.push($(this).text());
15 });
17};
18
19async function getFormData(req: Request) {
20 const data = await req.formData();
21 const aircraft = ("" + data.get("aircraft")).replace(" ", "");
34}
35
36function displayPlaneName(formData) {
37 if (formData && formData.boeingAircraft && formData.boeingAircraft.length > 0) {
38 return "💀 " + formData.boeingAircraft[0] + " 📉";
41}
42
43export default async function(req: Request) {
44 return new Response(
45 render(

testingmain.tsx2 matches

@samhashemi•Updated 1 year ago
9// );
10
11// export function handler(request: Request) {
12// let elements = fetchJSON(
13// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
18// }
19
20export default async function(req: Request): Promise<Response> {
21 return fetch(
22 "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",

QuillEditormain.tsx1 match

@rayman•Updated 1 year ago
1export default async function(req: Request) {
2 if (req.method === "POST") {
3 const name = (await req.formData()).get("name");

btcPriceAlertmain.tsx3 matches

@omaismoe•Updated 1 year ago
12};
13
14async function btcPriceAlert() {
15 const lastBtcPrice: number = await blob.getJSON("lastBtcPrice");
16 let btcPrice = await currency("usd", "btc");
28}
29
30async function ethPriceAlert() {
31 const lastEthPrice: number = await blob.getJSON("lastEthPrice");
32 let ethPrice = await currency("usd", "eth");
43}
44
45export default async function() {
46 await Promise.all([btcPriceAlert(), ethPriceAlert()]);
47}

purpleBeemain.tsx1 match

@rayman•Updated 1 year ago
1export default async function(req: Request) {
2 if (req.method === "POST") {
3 const name = (await req.formData()).get("name");

aqimain.tsx1 match

@ayush73•Updated 1 year ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "Dallas"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

passkey_scriptmain.tsx7 matches

@stevekrouse•Updated 1 year ago
20
21const _logEl = document.getElementById("logs");
22function log(message) {
23 console.log(message);
24 _logEl.innerHTML += `<pre>${JSON.stringify(message, null, 2)}</pre>`;
28
29const _statusEl = document.getElementById("status");
30function status(message) {
31 _statusEl.hidden = false;
32 _statusEl.innerText = message;
34}
35
36async function postJson(url, body?) {
37 return await fetch(url, {
38 method: "POST",
42}
43
44async function handleRegister() {
45 const username = document.getElementById("name").value;
46
57}
58
59async function startAuth(options, conditional) {
60 await SimpleWebAuthnBrowser.startAuthentication(options, conditional)
61 .then(log)
74});
75
76async function handleLogin() {
77 const username = document.getElementById("name").value;
78
80}
81
82async function handleLogout() {
83 await postJson("/logout");
84 status("✅ Logged out!");

passkeys_demomain.tsx3 matches

@stevekrouse•Updated 1 year ago
23
24// UTILS
25function generateJWT(userId: string) {
26 return new SignJWT({ userId }).setProtectedHeader({ alg: "HS256" }).sign(SECRET);
27}
28function verifyJWT(token: string) {
29 return jwtVerify(token, SECRET);
30}
31function generateRandomString() {
32 return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
33}

connect4_agent_randmain.tsx1 match

@saolsen•Updated 1 year ago
9import { agentHandler } from "https://esm.town/v/saolsen/gameplay_agent";
10
11function rand_action(
12 state: Connect4State,
13 agent_data?: { counter: number },

poker_agent_foldsmain.tsx1 match

@saolsen•Updated 1 year ago
7} from "https://esm.town/v/saolsen/gameplay_poker";
8
9function fold_action(
10 view: PokerView,
11 _agent_data?: JsonObject,

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