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=760&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 7802 results for "function"(508ms)

resyBotREADME.md1 match

@maxm•Updated 7 months ago
11import { email } from "https://esm.town/v/std/email?v=13";
12
13export default async function (interval: Interval) {
14 const bookingInfo = await resyBot( {
15 slug: 'amaro-bar',

grievingYellowAspmain.tsx3 matches

@stevekrouse•Updated 7 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" } });

buttonmain.tsx2 matches

@stevekrouse•Updated 7 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function server(req: Request): Promise<Response> {
4 async function inlineUrls(cssString: string) {
5 const urlRegex = /url\(['"]?(.*?)['"]?\)/g;
6 let result = cssString;

infoboxCrawlermain.tsx7 matches

@stevekrouse•Updated 7 months ago
10const TITLE_SELECTOR = "#firstHeading > span";
11
12function labelPredicate(label) {
13 return label === "Father" || label === "Mother" || /^Parent/.test(label) || label === "Children" || /^Child/.test(label);
14}
15
16async function* crawlWikipedia(
17 url: string,
18 generation: number = 0,
60}
61
62function App() {
63 const [url, setUrl] = useState("");
64 const [nodes, setNodes] = useState([]);
148 });
149
150 cyRef.current.on("tap", "node", function(evt) {
151 if (isCytoscapeDisabled) return;
152 const node = evt.target;
154 });
155
156 cyRef.current.on("layoutstop", function() {
157 cyRef.current.center();
158 cyRef.current.fit();
255}
256
257function client() {
258 createRoot(document.getElementById("root")).render(<App />);
259}
263}
264
265async function server(req: Request): Promise<Response> {
266 const url = new URL(req.url);
267

pushmain.tsx1 match

@stevekrouse•Updated 8 months ago
85<script src="https://cdn.jsdelivr.net/gh/philfung/add-to-homescreen@1.9/dist/add-to-homescreen.min.js"></script>
86<script>
87document.addEventListener('DOMContentLoaded', function () {
88 window.AddToHomeScreenInstance = new window.AddToHomeScreen({
89 appName: 'ValPush',

ministerialLavenderSlothmain.tsx1 match

@maxm•Updated 8 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2export default async function(req: Request): Promise<Response> {
3 const openai = new OpenAI();
4 const stream = await openai.chat.completions.create({

pgliteNpmmain.tsx1 match

@maxm•Updated 8 months ago
15 `);
16
17export default async function(req: Request): Promise<Response> {
18 await db.query(`
19 UPDATE test

excalidrawPassmain.tsx1 match

@maxm•Updated 8 months ago
1// This approach adds Lucia authentication with signup to the existing Excalidraw implementation.
2// We'll use the luciaMiddleware to handle authentication and redirect unauthenticated users.
3// The Excalidraw functionality will only be accessible to authenticated users.
4
5import { html } from "https://esm.sh/common-tags@1.8.2";

forwardermain.tsx1 match

@maxm•Updated 8 months ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

requestCollectormain.tsx2 matches

@maxm•Updated 8 months ago
26}
27
28function App({ requests, stats, fullRequest }: { requests: RequestData[], stats: Stats, fullRequest?: RequestData }) {
29 return (
30 <div>
84}
85
86export default async function server(request: Request): Promise<Response> {
87 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
88 const SCHEMA_VERSION = 1;

getFileEmail4 file matches

@shouser•Updated 6 days ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago