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/image-url.jpg%20%22Image%20title%22?q=function&page=2353&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 27410 results for "function"(1770ms)

pushmain.tsx1 match

@yawnxyz•Updated 9 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',

knowledgeExplorermain.tsx3 matches

@sharanbabu•Updated 9 months ago
10const SUGGESTIONS = ["Quantum Computing", "Renaissance Art", "Climate Change", "Artificial Intelligence", "Space Exploration"];
11
12function App() {
13 const [topic, setTopic] = useState("");
14 const [content, setContent] = useState("");
134}
135
136function client() {
137 createRoot(document.getElementById("root")).render(<App />);
138}
142}
143
144async function server(request: Request): Promise<Response> {
145 if (request.method === "POST" && new URL(request.url).pathname === "/generate") {
146 const { topic, prompt, direction } = await request.json();

taxratesmain.tsx4 matches

@stevekrouse•Updated 9 months ago
44}
45
46function parseCsv(csv: string): TaxBracket[] {
47 const lines = csv.trim().split("\n");
48 const headers = lines.shift()?.split(",");
59}
60
61function calculateTax(
62 income: number,
63 filingStatus: string,
91};
92
93function generateHtml(taxBrackets: TaxBracket[], selectedFilingStatus: string): string {
94 let tableRows = "";
95 for (let income = 0; income <= 1000000; income += 1000) {
147}
148
149export default async function main(req: Request): Promise<Response> {
150 const taxBrackets = parseCsv(csvData);
151 const url = new URL(req.url);

outsideBlushShrimpmain.tsx2 matches

@MichaelNollox•Updated 9 months ago
9 * @param val Define which val should open. Defaults to the root reference
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style, variant }: { val?: ValRef; style?: string; variant?: 'default' | 'green' } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style, variant }: { val?: ValRef; style?: string; variant?: 'default' | 'green' } = {},

outsideBlushShrimpREADME.md1 match

@MichaelNollox•Updated 9 months ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

crazyPeachCrayfishREADME.md1 match

@MichaelNollox•Updated 9 months ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

crazyPeachCrayfishmain.tsx2 matches

@MichaelNollox•Updated 9 months ago
9 * @param val Define which val should open. Defaults to the root reference
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style }: { val?: ValRef; style?: string } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},

codeOnValTownREADME.md1 match

@MichaelNollox•Updated 9 months ago
49### Linking to the val
50
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`

codeOnValTownmain.tsx2 matches

@MichaelNollox•Updated 9 months ago
9 * @param val Define which val should open. Defaults to the root reference
10 */
11export function modifyHtmlString(
12 bodyText: string,
13 { val, style }: { val?: ValRef; style?: string } = {},
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},

emperorOfJapanCrawlermain.tsx2 matches

@jdan•Updated 9 months ago
6const TITLE_SELECTOR = "#firstHeading > span";
7
8async function crawlWikipedia(url: string, visited: Set<string> = new Set()): Promise<string[]> {
9 if (visited.has(url)) {
10 return [];
39}
40
41export default async function server(req: Request): Promise<Response> {
42 const url = new URL(req.url);
43 const startUrl = url.searchParams.get('url');

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month 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.