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=1435&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 18726 results for "function"(4073ms)

GDI_URLParserServicemain.tsx1 match

@rozekUpdated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 const path = url.pathname;

GDI_ServerTimeServicemain.tsx2 matches

@rozekUpdated 7 months ago
1export default async function(req: Request): Promise<Response> {
2 const now = new Date();
3 const hours = now.getHours().toString().padStart(2, "0");
12}
13
14function generateTimeAsciiArt(time: string): string {
15 const digits = {
16 "0": [

GDI_HelloWorldServicemain.tsx1 match

@rozekUpdated 7 months ago
1export default async function (req: Request): Promise<Response> {
2 const asciiArt = `
3 _ _ _ _ __ __ _ _ _

GDI_TemperatureConvertermain.tsx4 matches

@rozekUpdated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function TemperatureConverter() {
6 const [celsius, setCelsius] = useState('');
7 const [fahrenheit, setFahrenheit] = useState('');
46}
47
48function App() {
49 return (
50 <div className="container">
54}
55
56function client() {
57 const root = document.getElementById('root');
58 if (root) {
65}
66
67export default async function server(request: Request): Promise<Response> {
68 return new Response(`
69 <html>

GDI_AnalogClockmain.tsx5 matches

@rozekUpdated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function AnalogClock({ time }) {
6 const hourMarks = Array.from({ length: 12 }, (_, i) => i);
7 const minuteMarks = Array.from({ length: 60 }, (_, i) => i);
38}
39
40function App() {
41 const [time, setTime] = useState(new Date());
42
61}
62
63function client() {
64 const root = document.getElementById('root');
65 if (root) {
72}
73
74export default async function server(request: Request): Promise<Response> {
75 return new Response(`
76 <html>
156 transform: rotate(90deg);
157 transition: all 0.05s;
158 transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1);
159}
160

GDI_DigitalClockmain.tsx3 matches

@rozekUpdated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [time, setTime] = useState(new Date());
7
30}
31
32function client() {
33 const root = document.getElementById('root');
34 if (root) {
41}
42
43export default async function server(request: Request): Promise<Response> {
44 return new Response(`
45 <html>

GDI_HelloWorldmain.tsx3 matches

@rozekUpdated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 return (
7 <div className="container">
11}
12
13function client() {
14 const root = document.getElementById('root');
15 if (root) {
22}
23
24export default async function server(request: Request): Promise<Response> {
25 return new Response(`
26 <html>

getReverseDependenciesmain.tsx1 match

@peterqliuUpdated 7 months ago
8};
9
10export async function getReverseDependencies(valUrlOrSlug: string): Promise<Module[]> {
11 // clean the url or slug
12 const initialSlug = valUrlOrSlug.includes("/v/")

dependency_graphmain.tsx1 match

@peterqliuUpdated 7 months ago
55`;
56
57async function makePage(markdown: string, title: string) {
58 return await gfm(markdown + footerMarkdown, { title, favicon: "🖇️" });
59}

HTTP_analogClockmain.tsx4 matches

@rozekUpdated 7 months ago
6const html = htm.bind(h);
7
8function AnalogClock() {
9 const [time, setTime] = useState(null);
10
48}
49
50function App() {
51 return html`
52 <div class="container">
56}
57
58function client() {
59 render(html`<${App} />`, document.getElementById("root"));
60}
64}
65
66export default async function server(request: Request): Promise<Response> {
67 return new Response(
68 `

getFileEmail4 file matches

@shouserUpdated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkUpdated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",