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=1493&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 17289 results for "function"(1895ms)

roastCastmain.tsx5 matches

@jamiedubs•Updated 1 year ago
4import process from "node:process";
5
6async function fetchCast({ fid, hash }: { fid: string; hash: string }) {
7 console.log("fetchCast", { fid, hash });
8 const res = await fetch(
27}
28
29async function runGlif({ inputs }: { inputs: string[] }): Promise<RunGlifResponse> {
30 const id = "cluu91eda000cv8jd675qsrby" as const;
31 const body = { id, inputs };
50}
51
52async function postCast({ text, replyToFid, replyToHash }: { text: string; replyToFid: string; replyToHash: string }) {
53 if (!process.env.FARCASTER_SIGNER_ID || !process.env.PINATA_JWT) {
54 throw new Error("missing required ENV vars");
90}
91
92async function runGlifAndPost({ inputs, cast }: { inputs: string[]; cast: { fid: string; hash: string } }) {
93 const glifRes = await runGlif({ inputs });
94 console.log({ glifRes });
98}
99
100export default async function(req: Request): Promise<Response> {
101 // console.log("req", req);
102 if (!process.env.GLIF_API_TOKEN) {

indie_authmain.tsx1 match

@pomdtr•Updated 1 year ago
5type HandlerFunc = (req?: Request) => Response | Promise<Response>;
6
7export function indieauth(handler: HandlerFunc, params: {
8 clientID: string;
9}): HandlerFunc {

reactEmailTemplatemain.tsx1 match

@tomas_padrieza•Updated 1 year ago
6import { sendMail } from "https://esm.town/v/tomas_padrieza/sendEmail";
7
8export function Email(props) {
9 const { url } = props;
10

sendEmailmain.tsx1 match

@tomas_padrieza•Updated 1 year ago
14};
15
16export function sendMail(to, subject, html) {
17 transport.sendMail({ ...options, to, subject, html });
18

sendEmailREADME.md1 match

@tomas_padrieza•Updated 1 year ago
1Simple function to provide the Email sending capability. The internal is limited to the `Pro` version only.

serve_readmemain.tsx2 matches

@pomdtr•Updated 1 year ago
4import { html } from "https://esm.town/v/stevekrouse/html?v=5";
5
6export async function valReadme({ val, title }: {
7 val: { author: string; name: string };
8 title?: string;
15}
16
17export function serveReadme({ val, title }: {
18 val: { author: string; name: string };
19 title?: string;

aqimain.tsx1 match

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

testmain.tsx1 match

@ayvanov•Updated 1 year ago
1export default async function (interval: Interval) {
2
3}

subscribeToNewslettermain.tsx3 matches

@dvsj•Updated 1 year ago
5const botProtectionAnswer = "0";
6
7export default async function(req: Request): Promise<Response> {
8 // Get the data from URL's query params
9 const url = new URL(req.url);
26}
27
28async function sendEmail(userContact, userData) {
29 userContact = decodeURIComponent(userContact);
30 // Email body should have userData part only if it's present in query params
41}
42
43function validateInputs(botProtectionInput, userContact) {
44 let isValid = true;
45 let errorMsg = "";

aqimain.tsx1 match

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

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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": "*",