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=659&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 7849 results for "function"(485ms)

ampleTanBuzzardmain.tsx1 match

@charmaine•Updated 1 month ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

constantAmaranthGazellemain.tsx1 match

@charmaine•Updated 1 month ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

linkInBioTemplatemain.tsx1 match

@charmaine•Updated 1 month ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

weatherBotmain.tsx11 matches

@charmaine•Updated 1 month ago
9 "latLngOfCity": {
10 openAiTool: {
11 type: "function",
12 function: {
13 name: "latLngOfCity",
14 description: "Get the latitude and longitude of a city",
34 "weatherOfLatLon": {
35 openAiTool: {
36 type: "function",
37 function: {
38 name: "weatherOfLatLon",
39 description: "Get the latitude and longitude of a city",
61 "fetchWebpage": {
62 openAiTool: {
63 type: "function",
64 function: {
65 name: "fetchWebpage",
66 description: "Fetch the weather forecast from the contents of a forecast URL",
91];
92
93function truncate(response: string | object) {
94 const TRUNCATE_LEN = 60;
95 const responseStr = typeof response === "string" ? response : JSON.stringify(response);
99}
100
101async function runConversation() {
102 const response = await openai.chat.completions.create({
103 messages: transcript,
111 if (message.tool_calls) {
112 for (let i = 0; i < message.tool_calls.length; i++) {
113 console.log("[CALLING]", message.tool_calls[i].function);
114 const tool = toolbox[message.tool_calls[i].function.name];
115 if (tool) {
116 const result = await tool.call(JSON.parse(message.tool_calls[i].function.arguments));
117 console.log("[RESULT]", truncate(result));
118 transcript.push({

aqimain.tsx1 match

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

sailingNotifyCronmain.tsx1 match

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

powderNotifyCronmain.tsx1 match

@charmaine•Updated 1 month ago
1import { powderNotify } from "https://esm.town/v/chet/powderNotify";
2
3export default async function(interval: Interval) {
4 await Promise.all([
5 powderNotify("Truckee, CA"),

weatherGPTmain.tsx1 match

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

Which_Jacketmain.tsx1 match

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

hello_migratedmain.tsx1 match

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

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago