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=1674&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 18579 results for "function"(2262ms)

get_current_weathermain.tsx1 match

@cosmo•Updated 1 year ago
1export async function getCurrentWeather(latitude = 0, longitude = 0) {
2 const pointsResponse = await fetch(`https://api.weather.gov/points/${latitude},${longitude}`),
3 { properties: { forecastHourly } } = await pointsResponse.json(),

untitled_beigeCrabmain.tsx1 match

@tmcw•Updated 1 year ago
1export async function handle() {
2 // Schedule work to do later
3 new Promise<void>(async (resolve) => {

beaconmain.tsx1 match

@visnup•Updated 1 year ago
2import { parse } from "npm:cookie";
3
4export default async function(req: Request): Promise<Response> {
5 const origin = req.headers.get("origin") ?? "*";
6 const { D = randomUUID() } = parse(req.headers.get("cookie") ?? "");

sleepermain.tsx2 matches

@jamiedubs•Updated 1 year ago
1// a very slow and sleepy function
2// pass it ?sleep=33 to make it sleep for that amount of sleep
3export default async function (req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const sleepQueryParam = url.searchParams.get('sleep');

status401main.tsx1 match

@patrickroumanoff•Updated 1 year ago
1export default async function(req: Request): Promise<Response> {
2 console.log(req.url);
3 if (req.headers.get("x-fd-healthprobe") == "1") {

lowdbmain.tsx1 match

@pomdtr•Updated 1 year ago
18}
19
20async function BlobPreset<Data>(key: string, initialData: Data) {
21 const db = new Low(new Blob<Data>(key), initialData);
22 await db.read();

reply_to_slack_messageREADME.md1 match

@curtcox•Updated 1 year ago
1This val provides a way of readily having lots of different Slack bots that do different things and support different Slack workspaces without needing a bunch of Val Town accounts. If you only need a single bot on a single workspace, just go with the approach in the Val Town [docs](https://docs.val.town/integrations/slack/bot/).
2
3This bot is essentially the one described in the Val Town [docs](https://docs.val.town/integrations/slack/bot/), but without any of the details. Those are externalized by the SlackConfig and SlackFunction interfaces. It is just glue. In order to make it work, you will need the following additional glue:
4- a public HTTP val to handle requests like [this one](https://www.val.town/v/curtcox/Chatio)
5- a private val to supply any info missing from the public one like [this one](https://www.val.town/v/curtcox/_not_actually_private_so_that_you_can_see_it)

MattssailingNotifyCronmain.tsx1 match

@brezina•Updated 1 year ago
3import process from "node:process";
4
5export async function sailingNotifyCron({ lastRunAt }) {
6 const result = await sailingNotify("Fair Oaks, CA", 10);
7}

MattsSFsailingNotifymain.tsx1 match

@brezina•Updated 1 year ago
1import { getWeather } from "https://esm.town/v/chet/getWeather";
2import { email } from "https://esm.town/v/std/email";
3export async function sailingNotify(
4 where: string,
5 minWindMph = 1,

DeleteThingmain.tsx1 match

@cufaoil•Updated 1 year ago
1import { blob } from "https://esm.town/v/std/blob";
2import { set } from "https://esm.town/v/std/set?v=11";
3export default async function(req: Request): Promise<Response> {
4 const searchParams = new URL(req.url).searchParams;
5 let value = searchParams.get("todo");

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