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=1677&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 17298 results for "function"(1719ms)

getLemmyPostsmain.tsx2 matches

@pdebie•Updated 1 year ago
1// This tries to fetch a specific post on multiple Lemmpy instances
2// and can try to fix missing comments on a specific instance.
3export async function getLemmyPosts(instance: string, communityName: string) {
4 const { LemmyHttp } = await import("npm:lemmy-js-client");
5 let client = new LemmyHttp(`https://${instance}`, {
6 fetchFunction: fetch,
7 });
8 const { posts } = await client.getPosts({

api500main.tsx1 match

@matthamlin•Updated 1 year ago
1export function api500(req: express.Request, res: express.Response) {
2 res.status(503);
3 res.json({

api400main.tsx1 match

@matthamlin•Updated 1 year ago
1export function api400(req: express.Request, res: express.Response) {
2 res.status(400);
3 res.json({

myApimain.tsx1 match

@jfix•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

testHTMLmain.tsx1 match

@rodrigotello•Updated 1 year ago
1export function testHTML(req: express.Request, res: express.Response) {
2 res.send(
3 "<html lang='en'>" +

denoGameHTMLmain.tsx9 matches

@rodrigotello•Updated 1 year ago
27 };
28
29 function setup() {
30 createCanvas(800, 300);
31 resetGame();
32 }
33
34 function resetGame() {
35 dino = new Dino();
36 obstacles = [];
41 }
42
43 function draw() {
44 if (isGameOver) {
45 showGameOver();
94 }
95
96 function keyPressed() {
97 if (keyCode === 32) {
98 if (isGameOver) {
107 }
108
109 function gameOver() {
110 isGameOver = true;
111 let name = prompt("Enter your name (max 16 characters, no spaces):");
113 scoreboard.push({ name, score });
114
115 // Call the function to update the scoreboard on the Val Town API
116 updateScoreboard(name, score);
117 }
118
119 function updateScoreboard(name, score) {
120 const apiUrl =
121 "https://api.val.town/v1/run/rodrigotello.updateDinoScoreboard";
147 }
148
149 function showGameOver() {
150 background(255);
151 textAlign(CENTER);
176 }
177
178 function showGamePaused() {
179 background(255);
180 textAlign(CENTER);

peelSessionLettersmain.tsx1 match

@aeaton•Updated 1 year ago
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function peelSessionLetters() {
4 const url = `https://www.bbc.co.uk/radio1/johnpeel/artists/`;
5 const dom = await fetchHtmlDom(url);

myApimain.tsx1 match

@sander•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@pmenze•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@sarincasm•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

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": "*",