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=1353&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 18949 results for "function"(1977ms)

blob_adminmain.tsx8 matches

@cameronpakUpdated 5 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"));

zanySalmonPorpoisemain.tsx1 match

@anhv_12Updated 5 months ago
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",

parallaxWordsValmain.tsx3 matches

@ashryanioUpdated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function ParallaxWords() {
6 const [words] = useState([
7 "金", "将来", "自分", "ない", "外国人", "答え", "不自由", "久しぶり",
116}
117
118function client() {
119 createRoot(document.getElementById("root")).render(<ParallaxWords />);
120}
121if (typeof document !== "undefined") { client(); }
122
123export default async function server(request: Request): Promise<Response> {
124 return new Response(`
125 <html>

dm_callback_examplemain.tsx1 match

@karanganesanUpdated 5 months ago
1export default async function(req: Request): Promise<Response> {
2 const timeNow = new Date();
3 // give me time in ist time detailed use js

jsonmain.tsx1 match

@tigaUpdated 5 months ago
3import { v4 as uuidV4 } from "npm:uuid";
4
5export default async function(req: Request): Promise<Response> {
6 return Response.json({
7 ok: true,

blob_adminmain.tsx8 matches

@eowczarekUpdated 5 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"));

notionDbCalendarFeedmain.tsx3 matches

@baoUpdated 5 months ago
1import { Client } from "https://esm.sh/@notionhq/client";
2
3export default async function server(request: Request): Promise<Response> {
4 try {
5 // Ensure Notion API key is set
77}
78
79function generateICalFeed(events) {
80 const icalLines = [
81 "BEGIN:VCALENDAR",
101}
102
103function formatICalDate(dateString) {
104 if (!dateString) return "";
105 const date = new Date(dateString);

findingsvgfilesmain.tsx7 matches

@richi1969Updated 5 months ago
20
21// Home Page
22function HomePage() {
23 return (
24 <div>
49
50// SVG Resources Page
51function SVGResourcesPage() {
52 return (
53 <div>
91
92// Cricut Guide Page
93function CricutGuidePage() {
94 return (
95 <div>
118
119// FAQ Page
120function FAQPage() {
121 return (
122 <div>
142
143// Routing Component
144function App() {
145 const [currentPage, setCurrentPage] = useState('home');
146
164}
165
166function client() {
167 createRoot(document.getElementById("root")).render(<App />);
168}
169if (typeof document !== "undefined") { client(); }
170
171export default async function server(request: Request): Promise<Response> {
172 const url = new URL(request.url);
173

youthfulLavenderMosquitomain.tsx3 matches

@yuhbuh505Updated 5 months ago
296}
297
298function App() {
299 const canvasRef = useRef<HTMLCanvasElement>(null);
300 const [game, setGame] = useState<BubbleShooterGame | null>(null);
348}
349
350function client() {
351 createRoot(document.getElementById("root")).render(<App />);
352}
353if (typeof document !== "undefined") { client(); }
354
355export default async function server(request: Request): Promise<Response> {
356 return new Response(`
357 <html>

wordclockmain.tsx4 matches

@manyoneUpdated 5 months ago
44].map(group => group.map(n => n - 1)); // Convert to 0-based index
45
46function findNearestFiveMinuteMark(minutes: number): number {
47 return Math.round(minutes / 5) * 5;
48}
49
50function TextualClock() {
51 const [highlightedIndices, setHighlightedIndices] = useState<number[]>([]);
52
120}
121
122function client() {
123 createRoot(document.getElementById("root")).render(<TextualClock />);
124}
126if (typeof document !== "undefined") { client(); }
127
128export default async function server(request: Request): Promise<Response> {
129 return new Response(`
130 <html>

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": "*",