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=730&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 7549 results for "function"(496ms)

blueskyBotTutorialblueskyScheduler1 match

@charmaine•Updated 2 months ago
1import { postToBluesky } from "./blueskyPost";
2
3export default async function(interval: Interval) {
4 await postToBluesky();
5}

blueskyBotTutorialblueskyPost1 match

@charmaine•Updated 2 months ago
1import { BskyAgent } from "npm:@atproto/api";
2
3export async function postToBluesky() {
4 const agent = new BskyAgent({
5 service: "https://bsky.social",

NotionJsSDKmain.tsx2 matches

@charmaine•Updated 2 months ago
7});
8
9// Example function to list Notion users
10export async function listNotionUsers() {
11 const listUsersResponse = await notion.users.list({});
12 return listUsersResponse;

BraintrustSDKtutorial1 match

@charmaine•Updated 2 months ago
3import { Eval } from "npm:braintrust";
4
5export default async function handler() {
6 const result = {
7 apiKeyStatus: null,

trackESMContentmain.tsx5 matches

@shouser•Updated 2 months ago
10const TABLE_NAME = `${KEY}_versions_v1`;
11
12async function fetchContent(url: string) {
13 const response = await fetch(url);
14 return await response.text();
15}
16
17async function initializeDatabase() {
18 await sqlite.execute(`
19 CREATE TABLE IF NOT EXISTS ${TABLE_NAME} (
26}
27
28export default async function(interval: Interval) {
29 await initializeDatabase();
30
56}
57
58async function sha256(message: string): Promise<string> {
59 const msgUint8 = new TextEncoder().encode(message);
60 const hashBuffer = await crypto.subtle.digest("SHA-256", msgUint8);
64}
65
66export async function getAllVersions() {
67 await initializeDatabase();
68 const versions = await sqlite.execute(`SELECT * FROM ${TABLE_NAME} ORDER BY timestamp DESC`);

getWeatherREADME.md1 match

@charmaine•Updated 2 months ago
1## Get Weather
2
3Simple function to get weather data from the free [wttr.in](https://wttr.in/:help) service.
4
5```ts

getWeathermain.tsx1 match

@charmaine•Updated 2 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}

runGetWeathermain.tsx1 match

@charmaine•Updated 2 months ago
1import { getWeather } from "https://esm.town/v/stevekrouse/getWeather";
2
3export default async function(interval: Interval) {
4 let weather = await getWeather("Brooklyn, NY");
5 console.log(weather.current_condition[0].FeelsLikeF);

APIBuilderTemplatefocusedCoffeeClam1 match

@dcm31•Updated 2 months ago
3import "swagger-ui-dist/swagger-ui.css";
4
5export default async function (req: Request): Promise<Response> {
6 const ui = SwaggerUI({
7 url: "https://petstore.swagger.io/v2/swagger.json",

APIBuilderTemplatefieryYellowHornet1 match

@dcm31•Updated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

getFileEmail4 file matches

@shouser•Updated 6 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago