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=947&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 17935 results for "function"(943ms)

friendlyIvoryVipermain.tsx3 matches

@girlfriend•Updated 2 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
99}
100
101function client() {
102 createRoot(document.getElementById("root")).render(<App />);
103}
104if (typeof document !== "undefined") { client(); }
105
106export default async function server(request: Request): Promise<Response> {
107 return new Response(
108 `

valentinemain.tsx3 matches

@girlfriend•Updated 2 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
98}
99
100function client() {
101 createRoot(document.getElementById("root")).render(<App />);
102}
103if (typeof document !== "undefined") { client(); }
104
105export default async function server(request: Request): Promise<Response> {
106 return new Response(
107 `

loanCalculatorPKRmain.tsx3 matches

@Aagharalig10•Updated 2 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function LoanCalculator() {
6 const [loanAmount, setLoanAmount] = useState('');
7 const [interestRate, setInterestRate] = useState('');
173}
174
175function client() {
176 createRoot(document.getElementById("root")).render(<LoanCalculator />);
177}
178if (typeof document !== "undefined") { client(); }
179
180export default async function server(request: Request): Promise<Response> {
181 return new Response(`
182 <html>

deadPixelTestmain.tsx4 matches

@wolf•Updated 2 months ago
11];
12
13function toggleColor(currentColor: number[]): number[] {
14 const currentIndex = RGB_COLORS.findIndex(
15 color => color.every((val, idx) => val === currentColor[idx])
19}
20
21function App() {
22 const [color, setColor] = useState(RGB_COLORS[0]);
23 const [isFullscreen, setIsFullscreen] = useState(false);
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
87if (typeof document !== "undefined") { client(); }
88
89export default function server(request: Request): Response {
90 return new Response(
91 `

linkifyDiscordBotmain.tsx7 matches

@jamiedubs•Updated 2 months ago
5import { registerDiscordSlashCommand } from "https://esm.town/v/neverstew/registerDiscordSlashCommand";
6
7function transformLink(url: string): string {
8 try {
9 const parsedUrl = new URL(url);
19}
20
21function DiscordSetupInstructions() {
22 return (
23 <div className="setup-instructions">
66}
67
68function InstallationLinks() {
69 const [applicationId, setApplicationId] = useState(null);
70
95}
96
97function App() {
98 const [url, setUrl] = useState("");
99 const [transformedUrl, setTransformedUrl] = useState("");
153}
154
155function client() {
156 createRoot(document.getElementById("root")).render(<App />);
157}
161}
162
163export default async function server(req: Request): Promise<Response> {
164 if (req.method === "GET") {
165 const url = new URL(req.url);
270
271 if (summarize) {
272 response.data.content += "\n\nSummary functionality is not implemented in this example.";
273 }
274

righteousCopperWildcatmain.tsx1 match

@SamuelAffran•Updated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

adroitBronzeBobolinkmain.tsx4 matches

@stevekrouse1•Updated 2 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function TodoList({ todos }: { todos: typeof todos }) {
8 return (
9 <div id="root">
30 dangerouslySetInnerHTML={{
31 __html: `
32 function TodoApp() {
33 const [input, setInput] = React.useState('');
34 const todos = window.todos;
75}
76
77function Html({ children }: { children: React.ReactNode }) {
78 return (
79 <html>
87}
88
89export default async function (req: Request): Promise<Response> {
90 const url = new URL(req.url);
91

uprightGreenLeoponmain.tsx8 matches

@cufaoil•Updated 2 months ago
13}
14
15function Tooltip({ children, content }: TooltipProps) {
16 const [isVisible, setIsVisible] = useState(false);
17 const tooltipRef = useRef<HTMLDivElement>(null);
52}
53
54function formatBytes(bytes: number, decimals = 2) {
55 if (bytes === 0) return "0 Bytes";
56 const k = 1024;
61}
62
63function copyToClipboard(text: string) {
64 navigator.clipboard.writeText(text).then(() => {
65 console.log("Text copied to clipboard");
69}
70
71function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
72 const [isOpen, setIsOpen] = useState(false);
73 const menuRef = useRef(null);
76
77 useEffect(() => {
78 function handleClickOutside(event) {
79 if (menuRef.current && !menuRef.current.contains(event.target)) {
80 event.stopPropagation();
158}
159
160function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
161 const [isLoading, setIsLoading] = useState(false);
162 const decodedKey = decodeURIComponent(blob.key);
219}
220
221function App({ initialEmail, initialProfile }) {
222 const encodeKey = (key: string) => encodeURIComponent(key);
223 const decodeKey = (key: string) => decodeURIComponent(key);
645}
646
647function client() {
648 const initialEmail = document.getElementById("root").getAttribute("data-email");
649 const initialProfile = JSON.parse(document.getElementById("root").getAttribute("data-profile"));

independentApricotDingomain.tsx3 matches

@MadScientistX•Updated 2 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
100}
101
102function client() {
103 createRoot(document.getElementById("root")).render(<App />);
104}
105if (typeof document !== "undefined") { client(); }
106
107export default async function server(request: Request): Promise<Response> {
108 return new Response(
109 `

valentinemain.tsx3 matches

@MadScientistX•Updated 2 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
100}
101
102function client() {
103 createRoot(document.getElementById("root")).render(<App />);
104}
105if (typeof document !== "undefined") { client(); }
106
107export default async function server(request: Request): Promise<Response> {
108 return new Response(
109 `

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 week 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": "*",