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=1567&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 18261 results for "function"(3398ms)

renderFormAndSaveDataREADME.md1 match

@sjerred•Updated 11 months ago
1# Render form and save data
2
3This val provides a web-based interface for collecting email addresses. It features a dual-functionality approach: when accessed via a web browser using a GET request, it serves an HTML form where users can submit their email address. If the script receives a POST request, it implies that the form has been submitted, and it proceeds to handle the incoming data.
4
5Fork this val to customize it and use it on your account.

weatherGPTmain.tsx1 match

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

caloriesmain.tsx2 matches

@stevekrouse•Updated 11 months ago
5import { Hono } from "npm:hono@3";
6
7function esmTown(url) {
8 return fetch(url, {
9 headers: {
92});
93
94export async function calorieEstimate(file: File) {
95 const dataURL = await fileToDataURL(file);
96 try {

launch_thrifty_idea_generatormain.tsx1 match

@cotr•Updated 11 months ago
1export default async function(req: Request): Promise<Response> {
2 if (req.method === "OPTIONS") {
3 return new Response("ok");

staticChessREADME.md1 match

@compuives•Updated 11 months ago
6Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
7
8Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
9
10Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

aqimain.tsx1 match

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

dubLinksUpsertmain.tsx1 match

@evilsteventey•Updated 11 months ago
7});
8
9export default async function(req: Request): Promise<Response> {
10 const { shortLink } = await dub.links.upsert({
11 url: "https://www.val.town/v/steventey/dubLinksUpsert",

apricotSlothmain.tsx1 match

@paulkinlan•Updated 11 months ago
5const newBoard = await board(() => {
6 const { result } = core.runJavascript({
7 code: "function name() { return { name: \"Hello\" };}",
8 "name": "name",
9 });

btcPriceAlertmain.tsx1 match

@thejian•Updated 11 months 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");

staticChessREADME.md1 match

@wesleychiyoka•Updated 11 months ago
6Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
7
8Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
9
10Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

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