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%22Image%20title%22?q=function&page=2358&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 27538 results for "function"(2144ms)

pleasedLavenderAlbatrossmain.tsx4 matches

@ganeshkumartk•Updated 9 months ago
18}
19
20function MicroReact({
21 id,
22 reactions = "12345",
54}
55
56function App() {
57 return (
58 <div>
76}
77
78function client() {
79 createRoot(document.getElementById("root")).render(<App />);
80}
84}
85
86export default async function server(request: Request): Promise<Response> {
87 return new Response(`
88 <html>

genvalmain.tsx2 matches

@andreterron•Updated 9 months ago
18 const inputClass = "p-2 border rounded w-full";
19 const labelClass = "w-full text-sm font-bold uppercase text-emerald-800 [&>span]:pl-0.5 flex flex-col gap-2";
20 function parseCookies(cookie: string) {
21 const out: Record<string, string> = {};
22 const c = cookie.split(";");
72 <label class=${labelClass} for="description">
73 <span>Description</span>
74 <input required class=${inputClass} id="description" name="description" type="text" placeholder="Function to return a random number" autocomplete="off" />
75 </label>
76 <button class="p-2 bg-emerald-500 text-white rounded" type="submit">Generate!</button>

pngTestmain.tsx1 match

@andreterron•Updated 9 months ago
1import { Buffer } from "node:buffer";
2
3export async function pngTest(req: Request): Promise<Response> {
4 var { default: pnglib } = await import("npm:pnglib");
5 const w = 64;

pngmain.tsx2 matches

@andreterron•Updated 9 months ago
2import { Buffer } from "node:buffer";
3
4export function png(
5 { width, height, depth = 256 }: {
6 width: number;
19 }) => void | Promise<void>,
20) {
21 return async function(req: Request) {
22 var img = await png64(
23 { width, height, depth },

AIDateInputmain.tsx3 matches

@ganeshkumartk•Updated 9 months ago
10const clearBtn = document.getElementById('clearBtn');
11
12function detectDate() {
13 const inputText = inputEl.value;
14 const parsedResults = parse(inputText);
36}
37
38function clearAll() {
39 inputEl.value = '';
40 outputEl.innerHTML = '';
42}
43
44function formatDate(date) {
45 if (!date) return '';
46 return date.toLocaleString('en-US', {

telegramBotHandlermain.tsx1 match

@stevekrouse•Updated 9 months ago
3import process from "node:process";
4
5export default async function server(req: Request): Promise<Response> {
6 let responseBody = "{}";
7

telegramValTownBotWebhookmain.tsx2 matches

@stevekrouse•Updated 9 months ago
6import { telegramSendMessage } from "https://esm.town/v/vtdocs/telegramSendMessage?v=5";
7
8export default async function server(req: Request): Promise<Response> {
9 // Verify this webhook came from our bot
10 if (
22 let chat = telegramValTownBotSecrets.find((c) => c.chatId === chatId);
23
24 // Helper function to message back the user that triggered this webhook
25 let messageBack = (message) =>
26 telegramSendMessage(Deno.env.get("telegramBot"), {

AIDateInputREADME.md3 matches

@ganeshkumartk•Updated 9 months ago
10- Shows both the parsed date and the original input text
11- Clean, minimalist UI with a clear input field
12- One-click clear functionality
13
14## How It Works
34
35- Modify the Tailwind CSS classes in the HTML to change the styling
36- Adjust the date formatting in the `formatDate` function
37- Change the parsing behavior by modifying the `detectDate` function
38
39## Dependencies

buttonmain.tsx2 matches

@stevekrouse•Updated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function server(req: Request): Promise<Response> {
4 async function inlineUrls(cssString: string) {
5 const urlRegex = /url\(['"]?(.*?)['"]?\)/g;
6 let result = cssString;

adorableRedChameleonmain.tsx3 matches

@jamisonl•Updated 9 months ago
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {

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.