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=822&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 8275 results for "function"(430ms)

testMutateSemanticsmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function testMutateSemantics({
5 stateName,
6 api,

chatGPTPluginmain.tsx1 match

@stevekrouse•Updated 1 year ago
3
4// https://stevekrouse-chatgptplugin.express.val.run/.well-known/ai-plugin.json
5export async function chatGPTPlugin(req: express.Request, res: express.Response) {
6 if (req.path === "/.well-known/ai-plugin.json") {
7 res.json({

openaiFineTunemain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function openaiFineTune({ key, model, trainingFile }: {
4 key: string;
5 model?: string;

parseSendGridEmailmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1export function parseSendGridEmail(input) {
2 function parseString(input) {
3 if (typeof input === "string") {
4 // parse email out of format like 'name <email@email.com>'

resendmain.tsx1 match

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function resend({ from, to, subject, html, text, apiKey }: {
4 from: string;
5 to: string;

signECDSAmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function signECDSA(message, key) {
2 let encoded = new TextEncoder().encode(message);
3 return crypto.subtle.sign(

updateInspoListmain.tsx1 match

@stevekrouse•Updated 1 year ago
3import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
4
5export async function updateInspoList(newList, auth) {
6 let handle = await verifyAPIAuth(auth);
7 if (isValTownTeam(handle)) {

genericmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function generic<A>(
2 arr: A[],
3 criteria: (a: A) => string

notifyNewMessagesmain.tsx1 match

@stevekrouse•Updated 1 year ago
2import { messages } from "https://esm.town/v/stevekrouse/messages";
3
4export function notifyNewMessages() {
5 if (messages.length > messagesLengthLast)
6 console.email(

fetchREADME.md1 match

@std•Updated 1 year ago
3The Javascript [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) is directly available within a Val. However sometimes fetch calls are blocked by the receiving server for using particular IP addresses. Additionally, network blips or unreliable web services may lead to failures if not handled properly.
4
5The Val Town standard library contains an alternative version, [`std/fetch`](https://www.val.town/v/std/fetch), that wraps the JavaScript Fetch API to provide additional functionality. The fetch function from [`std/fetch`](https://www.val.town/v/std/fetch) reroutes requests using a proxy vendor so that requests obtain different IP addresses. It also automatically retries failed requests several times. Note that using [`std/fetch`](https://www.val.town/v/std/fetch) will be significantly slower than directly calling the Javascript Fetch API due to extra network hops.
6
7## Usage

getFileEmail4 file matches

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

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago