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=788&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 8323 results for "function"(411ms)

perfmain.tsx3 matches

@stevekrouse•Updated 9 months ago
6import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
7
8// Utility functions
9const performSingleRequest = async (url) => {
10 const start = performance.now();
46};
47
48// Helper function to safely format numbers
49const safeToFixed = (number, decimalPlaces) => {
50 return number !== undefined && number !== null
286}
287
288export default async function(req: Request): Promise<Response> {
289 const stream = await renderToReadableStream(<App />, { bootstrapModules: [import.meta.url] });
290 return new Response(stream, { headers: { "content-type": "text/html" } });

brownPelicanmain.tsx1 match

@tmcw•Updated 9 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

twitterSearchmain.tsx1 match

@stevekrouse•Updated 9 months ago
3import { twitterUser } from "https://esm.town/v/stevekrouse/twitterUser";
4
5export async function twitterSearch({
6 query,
7 start_time,

cronLoggermain.tsx2 matches

@nbbaier•Updated 10 months ago
5import { refs } from "https://esm.town/v/stevekrouse/refs?v=11";
6
7type CronFunction = (interval: Interval) => Promise<void>;
8
9export const cronEvalLogger = (cron: CronFunction): CronFunction => {
10 let interval: Interval;
11 const cronProxy = new Proxy(cron, {

blobCommentsReactmain.tsx1 match

@stevekrouse•Updated 10 months ago
6import { blob } from "https://esm.town/v/std/blob?v=10";
7
8function App() {
9 const [comments, setComments] = useState();
10 const [newComment, setNewComment] = useState("");

automergeDemomain.tsx1 match

@stevekrouse•Updated 10 months ago
6await automerge.next.initializeBase64Wasm(automergeWasmBase64);
7
8export default async function(req: Request): Promise<Response> {
9 // from https://automerge.org/automerge/api-docs/js/
10 type DocType = { ideas: Array<automerge.Text> };

uptimemain.tsx1 match

@stevekrouse•Updated 10 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let reason: string, status: number, end: number;
10 let ok = true;

status_migratedmain.tsx3 matches

@stevekrouse•Updated 10 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

staticChessREADME.md1 match

@tmcw•Updated 10 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.

mootexmain.tsx1 match

@maxm•Updated 10 months ago
23};
24
25export default async function(req: Request): Promise<Response> {
26 const pageContent = renderToString(
27 <html>

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago