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/$%7Bsuccess?q=function&page=1675&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 20384 results for "function"(2692ms)

pglite_http_preview_runtimemain.tsx1 match

@samwillis•Updated 9 months ago
18})();
19
20export default async function(req: Request): Promise<Response> {
21 await init;
22 await pg.query(`

mortage_rate_drop_emailmain.tsx1 match

@alm•Updated 9 months ago
7 `https://api.stlouisfed.org/fred/series/observations?series_id=MORTGAGE30US&api_key=${fredApiKey}&file_type=json&sort_order=desc&limit=1`;
8
9export default async function main(req: Request) {
10 try {
11 const response = await fetch(fredApiUrl);

MuxAITranscriptmain.tsx6 matches

@decepulis•Updated 9 months ago
19});
20
21async function getMuxAsset(assetId: string) {
22 if (!assetId) throw "A Mux asset ID is required.";
23
51
52// transform ["Matt", "Nick"] into { "A": "Matt" , "B": "Nick" }
53function createSpeakersObject(speakersArray: string[]) {
54 if (speakersArray.length > 26) {
55 throw new Error("We only support 26 speakers for now");
63
64type MuxCuePoint = { startTime: number; endTime?: number; value: string };
65async function getCuePointsFromMux(asset: Mux.Video.Assets.Asset): Promise<MuxCuePoint[]> {
66 const transcriptTrack = asset.tracks.find(track => track.type === "text");
67 const playbackId = asset.playback_ids.find(playbackId => playbackId.policy === "public");
87
88type AssemblyAICuePoint = { startTime: number; endTime?: number; value: { speaker: string; text: string } };
89async function getCuePointsFromAssemblyAI(
90 asset: Mux.Video.Assets.Asset,
91 speakers: { [key: string]: string },
121}
122
123async function formatTextWithGPT4o(aaiCuePoints: AssemblyAICuePoint[]) {
124 const cues = aaiCuePoints.map(cue => ({
125 speaker: cue.value.speaker,
162}
163
164export default async function(req: Request): Promise<Response> {
165 if (req.method !== "POST") {
166 return Response.json({ nope: "we (currently) just POST in these parts " });

addmain.tsx1 match

@benjiwheeler•Updated 9 months ago
1export function add(a: number, b: number) {
2 return a + b;
3}
5const toolset = new OpenAIToolSet({ apiKey: COMPOSIO_API_KEY });
6
7// Creating an authentication function for the user
8const appName = "github";
9
10async function setupUserConnectionIfNotExists(entityId) {
11 const entity = toolset.client.getEntity(entityId);
12 const connection = await entity.getConnection(appName);
21}
22
23// Execution function
24async function executeAgent(entityName) {
25 const entity = toolset.client.getEntity(entityName);
26 await setupUserConnectionIfNotExists(entity.id);
47}
48
49// Call the execution function
50executeAgent("default");

htmlinhydeRSVPsmain.tsx1 match

@mbo•Updated 9 months ago
14 * When hit with a POST, it saves the name _and_ email of the person who has RSVPed.
15 */
16export default async function(req: Request): Promise<Response> {
17 let rsvps = await blob.getJSON("rsvps") as RSVP[];
18 rsvps ??= [];

misleadingScarletMongoosemain.tsx4 matches

@jeffreyyoung•Updated 9 months ago
2 * Returns a response to the user's query
3 */
4async function getResponse(req: Query, send: SendEventFn) {
5 send("meta", { content_type: "text/markdown" });
6 send("text", {
22 * Returns your bot's settings
23 */
24async function getBotSettings(): Promise<BotSettings> {
25 return {
26 allow_attachments: true,
93) => void;
94
95function encodeEvent(event: string, data: any = {}) {
96 return new TextEncoder().encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
97}
98
99export default async function(req: Request): Promise<Response> {
100 const reqBody = await req.json()
101 .catch((e) => {

sqliteExplorerAppREADME.md1 match

@axelknock•Updated 9 months ago
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
35- [x] add export to CSV, and JSON (CSV and JSON helper functions written in [this val](https://www.val.town/v/nbbaier/sqliteExportHelpers). Thanks to @pomdtr for merging the initial version!)
36- [x] add listener for cmd+enter to submit query

gltf_torusmain.tsx1 match

@saolsen•Updated 9 months ago
9const app = new Hono();
10
11function createTorus(radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2) {
12 const indicesArray = [];
13 const positionArray = [];

dateme_homemain.tsx1 match

@vawogbemi•Updated 9 months ago
5import Layout from "https://esm.town/v/vawogbemi/dateme_layout";
6
7export default function Home(c) {
8 return c.html(
9 <Layout activeTab={new URL(c.req.url).pathname}>

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 3 weeks ago
Simple functional CSS library for Val Town
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.