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/$%7Bart_info.art.src%7D?q=function&page=2018&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 30766 results for "function"(4623ms)

blob_adminmain.tsx8 matches

@jwork•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"));

deleteblobStoragemain.tsx8 matches

@jwork•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"));

quickGreenPandamain.tsx3 matches

@xoxtinyyy•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 `

valentinemain.tsx3 matches

@xoxtinyyy•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 `

EmojiPickerDemomain.tsx2 matches

@dcm31•Updated 2 months ago
1export default async function server(request: Request): Promise<Response> {
2 return new Response(`
3 <html>
21 <script src="https://esm.town/v/std/catch"></script>
22 <script>
23 window.onload = function() {
24 const pickerOptions = {
25 onEmojiSelect: (emoji) => {

hono-utilsmod.ts1 match

@pomdtr•Updated 2 months ago
6 options: ServeStaticOptions<E>
7): MiddlewareHandler => {
8 return function serveStatic(c, next) {
9 const getContent = async (url: string) => {
10 try {

podcast_blob_adminmain.tsx11 matches

@toowired•Updated 2 months ago
194};
195
196function LoginForm() {
197 const [username, setUsername] = React.useState("");
198 const [password, setPassword] = React.useState("");
235}
236
237function App() {
238 const [podcasts, setPodcasts] = React.useState<string[]>([]);
239 const [searchQuery, setSearchQuery] = React.useState('');
247 }, []);
248
249 async function checkAuthentication() {
250 const res = await fetch("/check-auth");
251 const auth = await res.json();
256 }
257
258 async function loadPodcasts() {
259 try {
260 const result = await podcast_blob_admin.list();
265 }
266
267 async function handleSearch() {
268 try {
269 const results = await podcast_blob_admin.search(searchQuery);
274 }
275
276 async function handleLogout() {
277 const res = await fetch("/logout", {
278 method: "POST",
322}
323
324function client() {
325 createRoot(document.getElementById("root")).render(<App />);
326}
327if (typeof document !== "undefined") { client(); }
328
329async function handleStore(request: Request): Promise<Response> {
330 const formData = await request.formData();
331 const file = formData.get('file') as File | null;
347}
348
349async function handleStream(request: Request): Promise<Response> {
350 const url = new URL(request.url);
351 const fileId = url.pathname.split('/').pop();
370}
371
372async function handleDelete(request: Request): Promise<Response> {
373 const url = new URL(request.url);
374 const fileId = url.pathname.split('/').pop();
383}
384
385export default async function server(request: Request): Promise<Response> {
386 const url = new URL(request.url);
387 const path = url.pathname;

utilsindex.ts3 matches

@MitP1997•Updated 2 months ago
2import { parseProject } from "../parseImportMeta/project.ts";
3
4export async function readFile(path: string, metaImportUrl: string) {
5 const project = parseProject(metaImportUrl);
6 let pathFragment = path.startsWith("/") ? path.slice(1) : path; // remove the leading slash
15}
16
17export async function listFiles(metaImportUrl: string) {
18 const vt = new ValTown();
19
35}
36
37export async function fetchTranspiledJavaScript(url: string) {
38 if (!url.startsWith("https://esm.town")) throw Error("Can only fetch from https://esm.town");
39 const res = await fetch(url, {

utilsREADME.md1 match

@MitP1997•Updated 2 months ago
6
7If you're running code in Val Town, sometimes you want to know
8information about the val that's running. This module has functions for that.
9
10## Usage

utilsproject.ts1 match

@MitP1997•Updated 2 months ago
20}
21
22export function parseProject(url: string): Project {
23 const pattern = /^https:\/\/esm\.town\/(?:v|p)\/([^/]+)\/([^@]+)@(\d+)-(.+?)(\/.*)?$/;
24 const match = url.match(pattern);
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.