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=1014&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 17289 results for "function"(2549ms)

codemirrorTsdemo2 matches

@tmcw•Updated 2 months ago
2import { renderToString } from "npm:react-dom/server"
3import { importMap } from "./importMap"
4export default async function(req: Request): Promise<Response> {
5 const u = new URL(req.url)
6
32let hasAnError: string = 10;
33
34function increment(num: number) {
35 return num + 1;
36}

selarAppmain.tsx3 matches

@selarcom•Updated 2 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [leads, setLeads] = useState([]);
7 const [newLead, setNewLead] = useState({
158};
159
160function client() {
161 createRoot(document.getElementById("root")).render(<App />);
162}
163if (typeof document !== "undefined") { client(); }
164
165export default async function server(request: Request): Promise<Response> {
166 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
167 const KEY = "selarApp";

toLocaleStringFormatGeneratormain.tsx3 matches

@jrunning•Updated 2 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [date, setDate] = useState(new Date().toISOString().split('T')[0] + 'T12:00');
7 const [locale, setLocale] = useState('en-US');
298}
299
300function client() {
301 createRoot(document.getElementById("root")).render(<App />);
302}
303if (typeof document !== "undefined") { client(); }
304
305export default async function server(request: Request): Promise<Response> {
306 return new Response(`
307 <html>

AlwaysHeremain.tsx3 matches

@AIWB•Updated 2 months ago
9}
10
11function App() {
12 const [name, setName] = useState("");
13 const [isNameEntered, setIsNameEntered] = useState(false);
263}
264
265function client() {
266 createRoot(document.getElementById("root")).render(<App />);
267}
271}
272
273export default async function server(request: Request): Promise<Response> {
274 // Handle voice processing
275 if (request.method === "POST" && new URL(request.url).pathname === "/process-voice") {

ShoutyJSONmain.tsx1 match

@curtcox•Updated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 let message: string | null = null;
3

pollRSSFeeds2main.tsx1 match

@stevekrouse•Updated 2 months ago
4import { newRSSItems } from "https://esm.town/v/stevekrouse/newRSSItems";
5
6export async function pollRSSFeeds2() {
7 let pollRSSInkAndSwitch = await blob.getJSON("pollRSSInkAndSwitch");
8 if (!pollRSSInkAndSwitch) {

CRON_JavascriptWeekly_RSS_Readermain.tsx1 match

@Skeye•Updated 2 months ago
5import * as convert from "npm:xml-js";
6
7export default async function(interval: Interval) {
8 // TODO : uncomment once the import worked
9 try {

readJavascriptWeeklyRSSmain.tsx1 match

@Skeye•Updated 2 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function readJavascriptWeeklyRss() {
4 try {
5 const response = await fetch("https://cprss.s3.amazonaws.com/javascriptweekly.com.xml");

API_Get_Weather_In_Frenchmain.tsx1 match

@Skeye•Updated 2 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function(req: Request): Promise<Response> {
4 console.log(req);
5 if (req.method === "GET") {

tronpickLoopmain.tsx1 match

@cyrilos•Updated 2 months ago
10
11// handle incoming requests
12export default async function(req) {
13 const PLATFORM = "tronpick.io";
14 // const cookies = await blob.getJSON("platforms");

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