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=1776&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 18147 results for "function"(3110ms)

vSpheremain.tsx1 match

@andrew•Updated 1 year ago
1export function vSphere(radius: number) {
2 const V = (4 / 3) * Math.PI * Math.pow(radius, 3);
3 return V;

reactSSRExamplemain.tsx3 matches

@jonbo•Updated 1 year ago
5 const React = await import("npm:react");
6 const ReactDOMServer = await import("npm:react-dom/server");
7 function BusTime(props) {
8 return React.createElement("span", null, "southbound in 5 minutes");
9 }
10 function BikeLocation(props) {
11 return React.createElement(
12 "li",
15 );
16 }
17 function BikesList(props) {
18 const bikeEls = props.items.map((item, index) => {
19 return React.createElement(BikeLocation, {

duckdbExamplemain.tsx1 match

@tmcw•Updated 1 year ago
2
3export let duckdbExample = (async () => {
4 async function createWorker(url: string) {
5 const workerScript = await fetch(url);
6 const workerURL = URL.createObjectURL(await workerScript.blob());

exampleExpressHandlermain.tsx1 match

@stevekrouse•Updated 1 year ago
1export async function exampleExpressHandler(
2 req: express.Request,
3 res: express.Response

runOnPageLoadmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function runOnPageLoad(name) {
2 console.email("page loaded!");
3 return `hi ${name} from val town!`;

setPollRSSInkAndSwitchmain.tsx1 match

@stevekrouse•Updated 1 year ago
1let { pollRSSInkAndSwitch } = await import("https://esm.town/v/stevekrouse/pollRSSInkAndSwitch");
2
3export function setPollRSSInkAndSwitch(newVal) {
4 pollRSSInkAndSwitch = newVal;
5}

rimemain.tsx2 matches

@stevekrouse•Updated 1 year ago
5// We provide some amount of free usage to this API
6// Callable with my API key via api(@stevekrosue.rime, {text: "blah blah", ...})
7export async function rime({ text, speaker, key }: {
8 text: string;
9 speaker: string;
13 return "Rime rate limit exceeded";
14 return fetchJSON(
15 "https://rjmopratfrdjgmfmaios.functions.supabase.co/rime-tts",
16 {
17 method: "POST",

testSemanticsmain.tsx1 match

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

awaitAllmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1export async function awaitAll(value: any): Promise<any> {
2 function isPlainObject(value: any) {
3 return (typeof value === "object" && value !== null &&
4 value.constructor === Object);
5 }
6 async function innerResolve(value: any, stack: any[]): Promise<any> {
7 const resolved = await value;
8 if (stack.includes(resolved)) {

rateLimitmain.tsx1 match

@stevekrouse•Updated 1 year ago
9// you can an email every time someone tries to call it past the limit
10// usage example: https://www.val.town/v/stevekrouse.ratedLimitedFuncEx
11export function rateLimit(
12 key: string,
13 limit = 1000,

getFileEmail4 file matches

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