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%20%22Optional%20title%22?q=function&page=2390&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 28554 results for "function"(2483ms)

welcomingPinkAlligatormain.tsx9 matches

@problem•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();

dailyDadJokemain.tsx1 match

@problem•Updated 7 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({

isMyWebsiteDownmain.tsx1 match

@zicklag•Updated 7 months ago
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;

vttThumbMakermain.tsx6 matches

@g•Updated 7 months ago
20export default app.fetch;
21
22function html() {
23 /*
24<!DOCTYPE html>
83}
84
85function css() {
86 /*
87body {
218}
219
220function js() {
221 /*
222const fileInput = document.getElementById('fileInput');
242let thumbnailMetadata;
243
244function updateUI() {
245 generateBtn.disabled = files.length === 0;
246 thumbWidth.disabled = keepAspectRatio.checked;
247}
248
249function resetToStep1() {
250 thumbnailOptions.style.display = 'block';
251 renderOptions.style.display = 'none';
377});
378
379function getImage(file) {
380 return new Promise((resolve) => {
381 const url = URL.createObjectURL(file);

seamlessBlushSwallowmain.tsx9 matches

@stevekrouse•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
61 }, [code, debouncedRenderShader]);
62
63 async function handleSubmit(e: React.FormEvent) {
64 e.preventDefault();
65 setLoading(true);
121}
122
123function client() {
124 createRoot(document.getElementById("root")!).render(<App />);
125}
129}
130
131function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
132 const gl = canvas.getContext("webgl");
133 if (!gl) {
143 `;
144
145 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
146 const shader = gl.createShader(type);
147 if (!shader) return null;
218}
219
220function extractGLSLCode(text: string): string {
221 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
222 return glslMatch
225}
226
227export default async function server(req: Request): Promise<Response> {
228 if (req.method === "POST") {
229 const anthropic = new Anthropic();

welcomingPinkAlligatormain.tsx9 matches

@stevekrouse•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();

welcomingPinkAlligatormain.tsx9 matches

@stevekrouse•Updated 7 months ago
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function debounce(func: Function, wait: number) {
7 let timeout: number | undefined;
8 return function executedFunction(...args: any[]) {
9 const later = () => {
10 clearTimeout(timeout);
16}
17
18function App() {
19 const [prompt, setPrompt] = useState("Generate a colorful gradient shader");
20 const [code, setCode] = useState(`
79 }, [code, debouncedRenderShader, retryCount]);
80
81 async function handleSubmit(e: React.FormEvent, shaderErrorMessage?: string) {
82 if (e) e.preventDefault();
83 setLoading(true);
149}
150
151function client() {
152 createRoot(document.getElementById("root")!).render(<App />);
153}
157}
158
159function renderShader(canvas: HTMLCanvasElement, fragmentShaderSource: string, time: number) {
160 const gl = canvas.getContext("webgl");
161 if (!gl) {
171 `;
172
173 function createShader(gl: WebGLRenderingContext, type: number, source: string) {
174 const shader = gl.createShader(type);
175 if (!shader) return null;
240}
241
242function extractGLSLCode(text: string): string {
243 const glslMatch = text.match(/```glsl\n([\s\S]*?)\n```/);
244 return glslMatch
247}
248
249export default async function server(req: Request): Promise<Response> {
250 if (req.method === "POST") {
251 const client = new Cerebras();

bsky_rss_pollmain.tsx1 match

@stevekrouse•Updated 7 months ago
3import { fetch } from "https://esm.town/v/std/fetch";
4
5export async function bsky_rss_poll() {
6 const { parseFeed } = await import("https://deno.land/x/rss/mod.ts");
7 const res = await fetch("https://v8.dev/blog.atom")

bsky_rss_pollREADME.md2 matches

@stevekrouse•Updated 7 months ago
4It's split into three parts:
51. [`bsky_rss_poll`](https://val.town/@jordan.bsky_rss_poll)
6 - This function runs every hour and polls the provided RSS feed, turns it into XML and runs the check. If there *is* a new post, it tell `rss_to_bsky`to post a link (and the title) to Bluesky
72. [`latest_rss`](https://val.town/@jordan.latest_rss)
8 - This is a stored object that keeps the latest object for the poll to test against
93. [`rss_to_bsky`](https://val.town/@jordan.rss_to_bsky)
10 - This function turns the text post into a rich text post and posts it to Bluesky
11
12Migrated from folder: Archive/bsky_rss_poll

extractValInfomain.tsx1 match

@devcriollo•Updated 7 months ago
1export function extractValInfo(url: string | URL) {
2 const { pathname, search } = new URL(url);
3 const [author, filename] = pathname.split("/").slice(-2);

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.