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=2308&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 28575 results for "function"(2597ms)

opengraphImageCreatormain.tsx3 matches

@itseieio•Updated 5 months ago
48}
49
50function App() {
51 const [backgroundImage, setBackgroundImage] = useState<string | null>(null);
52 const [backgroundConfig, setBackgroundConfig] = useState<BackgroundConfig>({
410}
411
412function client() {
413 createRoot(document.getElementById("root")).render(<App />);
414}
415if (typeof document !== "undefined") { client(); }
416
417export default async function server(request: Request): Promise<Response> {
418 return new Response(`
419 <html>

opengraphImageCreatormain.tsx3 matches

@stevekrouse•Updated 5 months ago
48}
49
50function App() {
51 const [backgroundImage, setBackgroundImage] = useState<string | null>(null);
52 const [backgroundConfig, setBackgroundConfig] = useState<BackgroundConfig>({
410}
411
412function client() {
413 createRoot(document.getElementById("root")).render(<App />);
414}
415if (typeof document !== "undefined") { client(); }
416
417export default async function server(request: Request): Promise<Response> {
418 return new Response(`
419 <html>

linkInBioTemplatemain.tsx1 match

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

simpleChatAPImain.tsx3 matches

@haeliyan•Updated 5 months ago
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
6 const [messages, setMessages] = useState([]);
7 const [newMessage, setNewMessage] = useState("");
243}
244
245function client() {
246 createRoot(document.getElementById("root")).render(<App />);
247}
248if (typeof document !== "undefined") { client(); }
249
250export default async function server(request: Request): Promise<Response> {
251 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
252 const KEY = "simpleChatAPI";

SermonGPTUImain.tsx5 matches

@manyone•Updated 5 months ago
78const endpointURL = "https://mjweaver01-sermongptapi.web.val.run";
79
80function App() {
81 const [question, setQuestion] = useState("");
82 const [response, setResponse] = useState("");
617}
618
619function client() {
620 const root = document.getElementById("root");
621 if (!root) throw new Error("Root element not found");
633}
634
635export default async function server(request: Request): Promise<Response> {
636 const { blob } = await import("https://esm.town/v/std/blob");
637
664}
665
666// Helper function to determine season based on current date
667function getSeason(date: Date): string {
668 const month = date.getMonth();
669 switch (true) {

legendaryRoseSwordfishmain.tsx3 matches

@ronr•Updated 5 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5function App() {
6 const [participants, setParticipants] = useState([]);
7 const [logs, setLogs] = useState([]);
217}
218
219function client() {
220 createRoot(document.getElementById("root")).render(<App />);
221}
225}
226
227export default async function server(req: Request): Promise<Response> {
228 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
229 const SCHEMA_VERSION = 3;

linkInBioTemplatemain.tsx1 match

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

emojiVectorEmbeddingsmain.tsx11 matches

@maxm•Updated 5 months ago
15]);
16// Get embedding for a single emoji
17async function getEmbedding(emoji: string): Promise<number[]> {
18 const result = await openai.embeddings.create({
19 input: emoji,
23}
24
25async function loadEmoji(e: string) {
26 const result = await sqlite.execute("SELECT 1 FROM emojis WHERE emoji = ?", [e]);
27 if (result.rows.length !== 0) {
43}
44
45async function loadAllEmojis() {
46 const batchSize = 20;
47 for (let i = 0; i < emojis.length; i += batchSize) {
54// await loadAllEmojis();
55
56export async function searchEmojis(query: string): Promise<string[]> {
57 return (await sqlite.execute(
58 `SELECT emoji
70// };
71
72// // Function to get all emojis (this is a subset for demonstration)
73
74// // Calculate cosine similarity between two vectors
75// function cosineSimilarity(vecA: number[], vecB: number[]): number {
76// const dotProduct = vecA.reduce((sum, a, i) => sum + a * vecB[i], 0);
77// const magnitudeA = Math.sqrt(vecA.reduce((sum, a) => sum + a * a, 0));
81
82// // Get embedding for a single emoji
83// async function getEmbedding(emoji: string): Promise<number[]> {
84// const result = await openai.embeddings.create({
85// input: emoji,
90
91// // Get embeddings for all emojis
92// async function getAllEmbeddings(): Promise<EmojiEmbedding[]> {
93// const emojis = getAllEmojis();
94// const embeddings: EmojiEmbedding[] = [];
116
117// // Find nearest neighbors for a given emoji
118// function findNearestNeighbors(
119// targetEmbedding: number[],
120// allEmbeddings: EmojiEmbedding[],
130// }
131
132// // Main function to demonstrate usage
133// async function main() {
134// try {
135// console.log("Getting embeddings for all emojis...");

fairAquaHeronmain.tsx1 match

@pomdtr•Updated 5 months ago
1export default async function() {
2 const body = await Deno.readFile("/opt/render/project/src/guest/index.ts");
3 return new Response(body);

SermonGPTAPImain.tsx2 matches

@mjweaver01•Updated 5 months ago
1export default async function server(request: Request): Promise<Response> {
2 const { blob } = await import("https://esm.town/v/std/blob");
3 const KEY = "sermon_generator";
182}
183
184function getSeason(date: Date): string {
185 const month = date.getMonth();
186 switch (true) {

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.