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=1752&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 19140 results for "function"(2546ms)

untitled_coffeeMacawmain.tsx1 match

@shaniehurvitz•Updated 1 year ago
8// Fetches a random joke.
9// Fetches a random joke.
10async function fetchRandomJoke() {
11 const response = await fetch(
12 "https://official-joke-api.appspot.com/random_joke",

aoc15_05main.tsx1 match

@karfau•Updated 1 year ago
1049console.log("solution *2:", secondStar(input));
1050
1051function debug<T>(value: T, msg = "debug"): T {
1052 console.log(msg, value);
1053 return value;

weatherGPTmain.tsx1 match

@ellenchisa•Updated 1 year ago
32console.log(text);
33
34export async function weatherGPT() {
35 await email({ subject: "Weather Today", text });
36}

emailRandomJokemain.tsx1 match

@liu_david3•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

aocXX_00README.md2 matches

@karfau•Updated 1 year ago
1This is a great template if you want to solve the <https://adventofcode.com> puzzles in a TDD style:
21. dump your puzzle input into the `input` function
32. copy/paste sample input and output from the page
43. once all assertions pass, the solution is calculated
5
6There is one function for each star that can be achieved.
7
8Some helpers for common tasks are defined at the end of code: `debug`, `toInt`, `exctractNumbers`, `sum`, ... ?

gronmain.tsx5 matches

@u•Updated 1 year ago
4};
5
6function parse(str: string) {
7 var i = 0;
8 var parts = [];
55 .slice(i + 2, closing)
56 .replace(regex[quote], quote)
57 .replace(/\\+/g, function(backslash) {
58 return new Array(Math.ceil(backslash.length / 2) + 1).join("\\");
59 }),
68}
69
70function degron(txt: string) {
71 const lines = txt.trim().split("\n");
72 const initializer = lines.shift()?.split(" = ")[1]; // initializer line
104)[];
105
106function materializeNameStack(nameStack: NameStack) {
107 return nameStack
108 .map((x) => {
119}
120
121function gron(json: any) {
122 const lines = [];
123

untitled_moccasinHeronmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export const str = "hello world";
2
3export default function handler(request: Request) {
4 return Response.json({ ok: true });
5}

untitled_purpleApemain.tsx1 match

@phoebedrouin•Updated 1 year ago
4};
5
6function fetchRandomJoke() {
7 const SAMPLE_JOKE = {
8 "setup": "What is the best way to explore Italy?",

untitled_crimsonSilkwormmain.tsx1 match

@e_hwun•Updated 1 year ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

annoymain.tsx1 match

@rcurtiss•Updated 1 year ago
3import { resume as resume2 } from "https://esm.town/v/ajax/resume";
4
5export async function annoy() {
6 const resume = resume2;
7 // const boo = await import("https://esm.sh/@atproto/api");

getFileEmail4 file matches

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