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=1540&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 17970 results for "function"(2080ms)

OpenAImain.tsx1 match

@pattysi•Updated 11 months ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

staticChessREADME.md1 match

@maxm•Updated 11 months ago
9Plain, brutalist, no bloat chess. Every page is only html and css. Every chess move is made by clicking a link. Send a link to your friend and they'll send you one back to make your move. No silly animations or slick interactivity to trip up your gameplay. When Google indexes this site will we successfully compute all possible chess moves?
10
11Functionality is quite limited, and things might be broken. Please let me know if you find bugs!
12
13Inspired by [this HN discussion](https://news.ycombinator.com/item?id=39456467) about sites that have all possible game states of tic-tac-toe.

bookmarkletsmain.tsx1 match

@pomdtr•Updated 11 months ago
9const app = new Hono();
10
11async function bookmarkletUrl(author: string, name: string) {
12 const resp = await fetch(`https://esm.town/v/${author}/${name}`);
13 const { code } = await minify(await resp.text());

linkInBioTemplatemain.tsx1 match

@stevekrouse•Updated 11 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

cron_client_react_forkmain.tsx5 matches

@stevekrouse•Updated 11 months ago
5import react_http from "https://esm.town/v/stevekrouse/react_http?v=6";
6
7export default function(req: Request) {
8 const url = new URL(req.url);
9 if (req.method === "GET" && url.pathname === "/") {
22}
23
24export function App() {
25 const browserTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
26 const [loading, setLoading] = useState(false);
27 const [cron, setCron] = useState("0 16 * * 1-5");
28 const onSubmit: React.FormEventHandler<HTMLFormElement> = async function(e) {
29 e.preventDefault();
30 setLoading(true);
84);
85
86function Cron({ cron, timezone }) {
87 let translation;
88 try {
107}
108
109async function compile(req: Request) {
110 const form = await req.formData();
111 const description = form.get("description") as string;

react_httpmain.tsx1 match

@stevekrouse•Updated 11 months ago
1export default function({ component, sourceURL, head }: { component: Function; sourceURL: string; head?: string }) {
2 return new Response(
3 `<html>

cron_client_side_script_forkmain.tsx2 matches

@stevekrouse•Updated 11 months ago
78});
79
80function clientScript() {
81 // Set the timezone input
82 const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
96}
97
98function Cron({ cron, timezone }) {
99 let translation;
100 try {

translatormain.tsx2 matches

@yawnxyz•Updated 11 months ago
291
292
293 // Helper function to get the supported MIME type
294 function getSupportedMimeType() {
295 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
296 const mimeTypes = [

getWeathermain.tsx1 match

@stevekrouse•Updated 12 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}

harlequinCobramain.tsx1 match

@stevekrouse•Updated 12 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(city: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${city}?format=j1`);
5}

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