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=2153&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 31197 results for "function"(16087ms)

EAN13genmain.tsx7 matches

@maxencelav•Updated 3 months ago
5import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
6
7function generateEAN13WithCheckDigit() {
8 // Generate the first 12 digits randomly
9 let ean12 = "";
29}
30
31function generateMultipleEAN13s(count) {
32 const eanList = [];
33 for (let i = 0; i < count; i++) {
37}
38
39function downloadSVG(code) {
40 const svgElement = document.querySelector(`svg[data-code="${code}"]`);
41 if (svgElement) {
51}
52
53function BarcodeDisplay({ code, width = 300, height = 150 }) {
54 const barcodeRef = useRef(null);
55
73}
74
75function App() {
76 const [numberOfEANs, setNumberOfEANs] = useState(10);
77 const [validEANs, setValidEANs] = useState([]);
298};
299
300function client() {
301 createRoot(document.getElementById("root")).render(<App />);
302}
304if (typeof document !== "undefined") { client(); }
305
306export default async function server(request: Request): Promise<Response> {
307 return new Response(
308 `

sdfasdfdsaREADME.md1 match

@charmaine•Updated 3 months ago
11## Usage
12
13This project preserves the functionality of the original vals with relative imports for better organization.
14

sdfasdfdsanewTestVal3 matches

@charmaine•Updated 3 months ago
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [todos, setTodos] = useState([]);
7 const [newTodo, setNewTodo] = useState("");
43}
44
45function client() {
46 createRoot(document.getElementById("root")).render(<App />);
47}
48if (typeof document !== "undefined") { client(); }
49
50export default async function server(request: Request): Promise<Response> {
51 return new Response(
52 `

jxnREADME.md1 match

@charmaine•Updated 3 months ago
14## Usage
15
16This project preserves the functionality of the original vals with relative imports for better organization.
17

jxnReactStream3 matches

@charmaine•Updated 3 months ago
22}
23
24export function render<T>(
25 /** Root-level React component that renders an entire <html> element
26 * including the head and body tags.
41 }
42
43 return async function handler(request: Request): Promise<Response> {
44 const main = reactStream(Component, module);
45 const middleware: Middleware[] = [
76 module: string | false,
77): Middleware =>
78 async function(req: DataRequest, res: Response): Promise<Response> {
79 const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
80

jxnredirects1 match

@charmaine•Updated 3 months ago
65];
66
67export default async function redirectMiddleware(req: DataRequest, res: Response, next): Promise<Response> {
68 const match = paths.find(p => p.match(req.data.pathname));
69 // const match = paths.find(p => p.regex.match(req.data.pathname));

jxnrss2 matches

@charmaine•Updated 3 months ago
4import type { Middleware } from "https://esm.town/v/jxnblk/ReactStream";
5
6function generateRSSFeed(posts) {
7 return `
8 <rss version="2.0">
27}
28
29function escapeXml(unsafe) {
30 return unsafe.replace(/[<>&'"]/g, c => {
31 switch (c) {

jxndotcom2 matches

@charmaine•Updated 3 months ago
36};
37
38async function getInitialProps(req: DataRequest, res: Response, next): Promise<Response> {
39 let params: Params = {};
40 let route: Route = Route.Home;
72}
73
74async function cacheHeaders(req: DataRequest, res: Response, next): Promise<Response> {
75 res.headers.set("Cache-Control", "max-age=31536000");
76 return next();

socialDataSearchmain.tsx1 match

@charmaine•Updated 3 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(

discordWebhookmain.tsx1 match

@charmaine•Updated 3 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://charmaine--5ad9e364-05c3-11f0-a042-569c3dd06744.web.val.run/"), {
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
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.