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=1469&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 19140 results for "function"(2041ms)

statusmain.tsx3 matches

@mateoclarke•Updated 7 months ago
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",

isMyWebsiteDownmain.tsx1 match

@mateoclarke•Updated 7 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;

GDI_AITranslatormain.tsx3 matches

@rozek_at_hft•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [germanText, setGermanText] = useState("");
7 const [englishTranslation, setEnglishTranslation] = useState("");
61}
62
63function client() {
64 createRoot(document.getElementById("root")).render(<App />);
65}
69}
70
71export default async function server(request: Request): Promise<Response> {
72 return new Response(
73 `

lovableVioletLandfowlmain.tsx5 matches

@eligosmlytics•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function Popup({ isOpen, onClose, content }) {
6 const [convertedImages, setConvertedImages] = useState({});
7 const [converting, setConverting] = useState({});
92}
93
94function HTMLPreview({ html, isFullView, toggleView }) {
95 return (
96 <div className="html-preview-container">
111}
112
113function App() {
114 const [url, setUrl] = useState('');
115 const [results, setResults] = useState(null);
305}
306
307function client() {
308 createRoot(document.getElementById("root")).render(<App />);
309}
313}
314
315export default async function server(request: Request): Promise<Response> {
316 const url = new URL(request.url);
317

imageToWebPConvertermain.tsx3 matches

@eligosmlytics•Updated 7 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [imageUrl, setImageUrl] = useState(null);
7 const [webpUrl, setWebpUrl] = useState(null);
93}
94
95function client() {
96 createRoot(document.getElementById("root")).render(<App />);
97}
99if (typeof document !== "undefined") { client(); }
100
101export default async function server(request: Request): Promise<Response> {
102 return new Response(`
103 <!DOCTYPE html>

steadfastCrimsonAlligatormain.tsx3 matches

@rudd•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [colors, setColors] = useState(['#ff0000', '#00ff00', '#0000ff']);
8 const [positions, setPositions] = useState([
89}
90
91function client() {
92 createRoot(document.getElementById("root")).render(<App />);
93}
94if (typeof document !== "undefined") { client(); }
95
96export default async function server(request: Request): Promise<Response> {
97 return new Response(`
98 <html>

forwardermain.tsx1 match

@nicosql•Updated 7 months ago
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {

aqimain.tsx1 match

@mateoclarke•Updated 7 months ago
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "80212"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });

italymain.tsx3 matches

@all•Updated 7 months ago
31};
32
33function App() {
34 const [hoveredRegion, setHoveredRegion] = useState("");
35 const [selectedRegions, setSelectedRegions] = useState([]);
296}
297
298function client() {
299 createRoot(document.getElementById("root")).render(<App />);
300}
304}
305
306export default async function server(request: Request): Promise<Response> {
307 return new Response(
308 `

genuineGrayWrenmain.tsx5 matches

@stevekrouse•Updated 7 months ago
23];
24
25function DraggableElement({ id, content, type, left, top, onDrop, isNew }) {
26 const [{ isDragging }, drag] = useDrag(() => ({
27 type: "element",
60}
61
62function cssStringToObject(cssString) {
63 return cssString.split(";").reduce((acc, rule) => {
64 const [key, value] = rule.split(":").map(str => str.trim());
159});
160
161function App() {
162 const [elements, setElements] = useState([]);
163 const [selectedModel, setSelectedModel] = useState(MODELS[0]);
274}
275
276function client() {
277 createRoot(document.getElementById("root")).render(<App />);
278}
282}
283
284async function server(request: Request): Promise<Response> {
285 const url = new URL(request.url);
286 const key = "infiniteUICombinations_3";

getFileEmail4 file matches

@shouser•Updated 2 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
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": "*",