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/image-url.jpg?q=function&page=2494&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 29176 results for "function"(1910ms)

jealousMagentaFleamain.tsx1 match

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

disgustedAzureChinchillamain.tsx1 match

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

violentGoldSnakemain.tsx1 match

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

chatmain.tsx1 match

@lt_07•Updated 8 months ago
23 });
24 const message = data.choices[0].message;
25 return message.function_call ? message.function_call : message.content;
26};

naughtyRedTunamain.tsx4 matches

@maxjoygit•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

hackerNewsDigestmain.tsx4 matches

@maxjoygit•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

bonsaimain.tsx12 matches

@loading•Updated 8 months ago
3import { renderToString } from "https://esm.sh/react-dom/server";
4
5function createScreenBuffer(width: number, height: number): string[][] {
6 const buffer: string[][] = [];
7 for (let y = 0; y < height; y++) {
150};
151
152function bufferToHtml(buffer: string[][], colors: any): string {
153 let html = "<pre style=\"line-height: 1; font-family: monospace;\">";
154 for (let y = 0; y < buffer.length; y++) {
212}
213
214function App() {
215 return (
216 <div>
228}
229
230export default async function server(request: Request): Promise<Response> {
231 const app = renderToString(<App />);
232
349 let screensaverInterval;
350
351 function applyTheme(theme) {
352 document.body.style.backgroundColor = theme.background;
353 document.body.style.color = theme.text;
362 }
363
364 function changeTheme() {
365 currentThemeIndex = (currentThemeIndex + 1) % themeNames.length;
366 const newTheme = themes[themeNames[currentThemeIndex]];
369 }
370
371 function bufferToHtml() {
372 let html = '<pre style="line-height: 1; font-family: monospace;">';
373 const currentTheme = themes[themeNames[currentThemeIndex]];
432 }
433
434 function growTreePart(y, x, type, life, direction = 0) {
435 if (life <= 0) return null;
436
480 }
481
482 function growTree() {
483 buffer = Array(height).fill().map(() => Array(width).fill(" "));
484 growQueue = [{ x: Math.floor(width / 2), y: height - 1, type: 0, life: 32, direction: 0 }];
485
486 function grow() {
487 if (growQueue.length === 0) return;
488
523 }
524
525 function updateTree() {
526 document.getElementById('tree-container').innerHTML = bufferToHtml();
527 setTimeout(() => {
534 }
535
536 function toggleScreensaver() {
537 screensaverMode = !screensaverMode;
538 document.body.classList.toggle('screensaver-mode', screensaverMode);

hackerNewsDigestmain.tsx4 matches

@citizen428•Updated 8 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
15}
16
17function createStoryHTML(story: any) {
18 return `
19 <li>
28}
29
30function createEmailContent(
31 topStories: any[],
32 newStories: any[],
118}
119
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);

netsaur_xorREADME.md1 match

@loading•Updated 8 months ago
1# Approximate the XOR function using netsaur
2
30 xor 0 = 0.003461432410404086 (should be close to 0)

spottySilverHawkmain.tsx3 matches

@all•Updated 8 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [activeButton, setActiveButton] = useState(null);
7
75}
76
77function client() {
78 createRoot(document.getElementById("root")).render(<App />);
79}
81if (typeof document !== "undefined") { client(); }
82
83export default async function server(request: Request): Promise<Response> {
84 return new Response(`
85 <!DOCTYPE html>
tuna

tuna9 file matches

@jxnblk•Updated 1 day 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.