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=2474&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 28559 results for "function"(5138ms)

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." }, {

relaxedSalmonHawkmain.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." }, {

linkInBioTemplatemain.tsx1 match

@daisuke•Updated 9 months ago
2import { renderToString } from "npm:react-dom/server";
3
4export default async function(req: Request) {
5 return new Response(
6 renderToString(

BlogChatbotServermain.tsx5 matches

@weaverwhale•Updated 9 months ago
25];
26
27// Function to search blog content
28function searchBlogContent(query: string) {
29 return blogPosts.filter(post =>
30 post.title.toLowerCase().includes(query.toLowerCase()) ||
58 const sendButton = document.getElementById('sendButton');
59
60 function addMessage(message, isUser = false) {
61 const messageElem = document.createElement('p');
62 messageElem.textContent = isUser ? \`You: \${message}\` : \`Bot: \${message}\`;
66 }
67
68 async function sendMessage() {
69 const message = userInput.value.trim();
70 if (!message) return;
136});
137
138export default async function server(req: Request): Promise<Response> {
139 return app.fetch(req);
140}

pushSendNotification_negrelmain.tsx3 matches

@jrmann100•Updated 9 months ago
2
3// https://github.com/web-push-libs/web-push/blob/v3.4.4/README.md#using-vapid-key-for-applicationserverkey
4function urlBase64ToUint8Array(b64) {
5 const padding = "=".repeat((4 - (b64.length % 4)) % 4);
6 const base64 = (b64 + padding)
19
20// https://stackoverflow.com/a/56848917/9068081
21function getPrivKeyJWK({ pubKey, privKey }: { pubKey: string; privKey: string }) {
22 const pubKeyArray = urlBase64ToUint8Array(pubKey);
23 const privKeyArray = urlBase64ToUint8Array(privKey);
49};
50
51async function importVapidKeys(
52 exportedKeys: { pubKey: string; privKey: string },
53 { crypto = globalThis.crypto.subtle, extractable = false }: {

ministerialLavenderSlothmain.tsx1 match

@maxm•Updated 9 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2export default async function(req: Request): Promise<Response> {
3 const openai = new OpenAI();
4 const stream = await openai.chat.completions.create({

pgliteNpmmain.tsx1 match

@maxm•Updated 9 months ago
15 `);
16
17export default async function(req: Request): Promise<Response> {
18 await db.query(`
19 UPDATE test

isMyWebsiteDownmain.tsx1 match

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

CIDGenerationmain.tsx2 matches

@stevedylandev•Updated 9 months ago
31};
32
33async function main() {
34 try {
35 const jsonData = {
46}
47
48async function pinFileToIPFS() {
49 try {
50 const jsonData = {

esmmain.tsx1 match

@pomdtr•Updated 9 months ago
2import { parseAuthorizationHeader } from "https://esm.town/v/pomdtr/parseAuthorizationHeader";
3
4export default async function(req: Request) {
5 const url = new URL(req.url);
6 const parts = url.pathname.slice(1).split("/");

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.