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=1673&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 20408 results for "function"(2265ms)

lucia_sqlitemain.tsx5 matches

@stevekrouse•Updated 9 months ago
4import { generateId, Scrypt } from "npm:lucia";
5
6export async function createTables(userTable: string, sessionTable: string) {
7 return sqlite.batch([
8 `CREATE TABLE ${userTable} (
20}
21
22async function safeExecute({ userTable, sessionTable, query, error }: {
23 userTable: string;
24 sessionTable: string;
38}
39
40export async function createUser({ userTable, sessionTable, username, password }: {
41 userTable: string;
42 sessionTable: string;
58}
59
60export async function getUser(
61 { userTable, sessionTable, username },
62): Promise<{ id: string; username: string; hashed_password: string } | null> {
74}
75
76export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
77 return new Scrypt().verify(hashed_password, password);
78}

pglite2main.tsx2 matches

@samwillis•Updated 9 months ago
4let pg;
5
6async function init() {
7 if (pg) return;
8 console.log(1);
25}
26
27export default async function(req: Request): Promise<Response> {
28 console.log(0);
29 await init();

aloneAquaGophermain.tsx4 matches

@parthstown•Updated 9 months ago
3console.log("potato", main);
4
5export default async function printWeather(req: Request) {
6 if (typeof main === "function") {
7 const newWeather = await main(req);
8
12 return new Response(JSON.stringify(data));
13 } else {
14 console.error("main is not a function");
15 return new Response("Error: main is not a function", { status: 500 });
16 }
17}

twitchmain.tsx1 match

@pinjasaur•Updated 9 months ago
1const getText = async url => (await fetch(url)).text();
2
3export default async function(req: Request): Promise<Response> {
4 if (req.headers.get("referer")?.includes("val.")) {
5 return Response.json({ error: "Cannot access from val.town" }, {

dieselREADME.md2 matches

@yawnxyz•Updated 9 months ago
9- **Multi-format Support**: Works with JSON, YAML, CSV, and TOML.
10- **Dynamic Selectors**: Use conditions to filter data dynamically.
11- **Function Support**: Built-in functions for data manipulation (e.g., length, sum, avg).
12- **Easy Integration**: Can be used in both Deno and Val Town environments.
13
17import Diesel from "https://esm.town/v/yawnxyz/diesel";
18
19async function main() {
20 const jsonData = `
21 {

YouTubeSubmissionsmain.tsx1 match

@mvmattgray•Updated 9 months ago
8const KEY = new URL(import.meta.url).pathname;
9
10export default async function main(req: Request): Promise<Response> {
11 const url = new URL(req.url);
12

whoIsHiringLayoutmain.tsx1 match

@vawogbemi•Updated 9 months ago
4const tabs = { "/": "Home", "/about": "About" }; // { "/": "Home", "/browse": "Browse", "/faq": "FAQ" };
5
6export default function({ activeTab, children }: PropsWithChildren<{ activeTab: string }>) {
7 return (
8 <html>

dialogmain.tsx12 matches

@jdan•Updated 9 months ago
30};
31
32function TitleBar(props) {
33 return (
34 <div
46}
47
48function TitleBarText(props) {
49 return (
50 <div
62}
63
64function TitleBarControls(props) {
65 return <div style={{ display: "flex" }}>{props.children}</div>;
66}
67
68function Button(props) {
69 return (
70 <div
90}
91
92function TitleBarControl(props) {
93 return (
94 <Button
118}
119
120function MinimizeButton(props) {
121 return (
122 <TitleBarControl
135}
136
137function MaximizeButton(props) {
138 return (
139 <TitleBarControl
150}
151
152function CloseButton(props) {
153 return (
154 <TitleBarControl
166}
167
168function Window(props) {
169 return (
170 <div
186}
187
188function WindowBody(props) {
189 return (
190 <div
202}
203
204function Text(props) {
205 return (
206 <div
219}
220
221function Row(props) {
222 return (
223 <div

getEndpointUrlmain.tsx2 matches

@g•Updated 9 months ago
1/**
2 * Function to extract the val HTTP endpoint URL.
3 * @example getEndpointUrl(import.meta.url)
4 * @returns endpoint url without a trailing slash
5 */
6export function getEndpointUrl(url: string | URL) {
7 const { pathname } = new URL(url);
8 const [author, filename] = pathname.split('/').slice(-2);

modifyImagemain.tsx1 match

@ilikescience•Updated 9 months ago
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },

getFileEmail4 file matches

@shouser•Updated 3 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
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.