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/$%7Burl%7D?q=function&page=2452&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 28348 results for "function"(2810ms)

pglitemain.tsx1 match

@iamseeley•Updated 9 months ago
11`);
12
13export default async function(req: Request): Promise<Response> {
14 const res = await db.query(`
15 UPDATE test

genimagemain.tsx3 matches

@motyar•Updated 9 months ago
10type GeneratedImage = { imageUrl: string; prompt: string };
11
12function App() {
13 const [prompt, setPrompt] = useState("");
14 const [imageUrl, setImageUrl] = useState("");
92}
93
94function client() {
95 createRoot(document.getElementById("root")).render(<App />);
96}
100}
101
102export default async function server(request: Request): Promise<Response> {
103 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
104 const url = new URL(request.url);

pglitemain.tsx1 match

@samwillis•Updated 9 months ago
11`);
12
13export default async function(req: Request): Promise<Response> {
14 const res = await db.query(`
15 UPDATE test

stagingdailyschedulemain.tsx2 matches

@keenanzucker•Updated 9 months ago
5import moment from "npm:moment";
6
7export default async function(req: Request): Promise<Response> {
8 // ============= Data Fetching =================
9 const today = new Date();
63 };
64
65 function groupSchedulesByDate(schedules) {
66 return schedules.reduce((acc, schedule) => {
67 const date = schedule.interval.start.split("T")[0];

aqi_lefkadamain.tsx1 match

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

concentricCirclesAppmain.tsx4 matches

@kaz•Updated 9 months ago
3 * Below each section, there's a text input field. Each color section can have up to 8 values.
4 * It uses React for the UI and CSS for styling the gradient line and inputs.
5 * It includes a reorder functionality for the items in each section and an expandable "Learn more" section.
6 */
7/** @jsxImportSource https://esm.sh/react */
9import { createRoot } from "https://esm.sh/react-dom/client";
10
11function App() {
12 const [redItems, setRedItems] = useState<string[]>([]);
13 const [yellowItems, setYellowItems] = useState<string[]>([]);
186}
187
188function client() {
189 createRoot(document.getElementById("root")).render(<App />);
190}
191if (typeof document !== "undefined") { client(); }
192
193async function server(request: Request): Promise<Response> {
194
195 return new Response(`

dailyDadJokemain.tsx1 match

@davidpadbury•Updated 9 months ago
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({

readableHtmlmain.tsx3 matches

@neverstew•Updated 9 months ago
6const JSDOM = jsdom.JSDOM;
7
8export function readableHtml(urlOrContent: URL | string, options?: RequestInit): Promise<string> {
9 if (typeof urlOrContent === "string") {
10 return readableHtmlFromText(urlOrContent);
15export default readableHtml;
16
17async function readableHtmlFromUrl(url: URL, options?: RequestInit): Promise<string> {
18 const body = await fetchText(url.toString(), options);
19 return readableHtmlFromText(body);
20}
21
22async function readableHtmlFromText(content: string): Promise<string> {
23 let doc = new JSDOM(content);
24 let reader = new Readability(doc.window.document);

githubRepoViewermain.tsx2 matches

@ejfox•Updated 9 months ago
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3
50
51 <script>
52 async function fetchFiles() {
53 const user = document.getElementById('user').value;
54 const repo = document.getElementById('repo').value;

amusedAquaHeronmain.tsx1 match

@codefromanywhere•Updated 9 months ago
1export default async function handler(request: Request) {
2 if (request.method !== "POST") {
3 return Response.json({ message: "This val responds to POST requests." }, {

getFileEmail4 file matches

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

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
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.