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/$%7Burl%7D?q=function&page=2027&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 28712 results for "function"(1762ms)

cerebras_codergenerate-code2 matches

@ankitvaltown•Updated 3 months ago
2import STARTER_PROMPTS from "../public/starter-prompts.js";
3
4function extractCodeFromFence(text: string): string {
5 const htmlMatch = text.match(/```html\n([\s\S]*?)\n```/);
6 return htmlMatch ? htmlMatch[1].trim() : text;
7}
8
9export async function generateCode(prompt: string, currentCode: string) {
10 const starterPrompt = STARTER_PROMPTS.find(p => p.prompt === prompt);
11 if (starterPrompt) {

hnValTownREADME.md1 match

@emere•Updated 3 months ago
40- Key: `mentionsDiscord`
41- Value: Your Discord webhook URL.
42Notifications will be sent using this function:
43```
44 await discordWebhook({

hnValTownmain.tsx1 match

@emere•Updated 3 months ago
4import process from "node:process";
5
6export async function hnValTown({ lastRunAt }: Interval) {
7 // Edit to update time frame
8 const twoMonthsAgo = new Date();

GeminiVoiceCallAppmain.tsx3 matches

@srijanb69•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function VoiceCallApp() {
6 const [isConnected, setIsConnected] = useState(false);
7 const [conversation, setConversation] = useState([]);
141}
142
143function client() {
144 createRoot(document.getElementById("root")).render(<VoiceCallApp />);
145}
146if (typeof document !== "undefined") { client(); }
147
148export default async function server(request: Request): Promise<Response> {
149 if (request.method === 'POST' && new URL(request.url).pathname === '/ai-response') {
150 const { OpenAI } = await import("https://esm.town/v/std/openai");

ChatteryGen2Flashmain.tsx3 matches

@srijanb69•Updated 3 months ago
9
10// Main App Component
11function App() {
12 const [messages, setMessages] = useState([]);
13 const [inputValue, setInputValue] = useState("");
242
243// Client-side rendering
244function client() {
245 createRoot(document.getElementById("root")).render(<App />);
246}
251
252// Server-side handler
253export default async function server(request: Request): Promise<Response> {
254 return new Response(
255 `

friendlyIvoryVipermain.tsx3 matches

@girlfriend•Updated 3 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
99}
100
101function client() {
102 createRoot(document.getElementById("root")).render(<App />);
103}
104if (typeof document !== "undefined") { client(); }
105
106export default async function server(request: Request): Promise<Response> {
107 return new Response(
108 `

valentinemain.tsx3 matches

@girlfriend•Updated 3 months ago
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
98}
99
100function client() {
101 createRoot(document.getElementById("root")).render(<App />);
102}
103if (typeof document !== "undefined") { client(); }
104
105export default async function server(request: Request): Promise<Response> {
106 return new Response(
107 `

loanCalculatorPKRmain.tsx3 matches

@Aagharalig10•Updated 3 months ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function LoanCalculator() {
6 const [loanAmount, setLoanAmount] = useState('');
7 const [interestRate, setInterestRate] = useState('');
173}
174
175function client() {
176 createRoot(document.getElementById("root")).render(<LoanCalculator />);
177}
178if (typeof document !== "undefined") { client(); }
179
180export default async function server(request: Request): Promise<Response> {
181 return new Response(`
182 <html>

deadPixelTestmain.tsx4 matches

@wolf•Updated 3 months ago
11];
12
13function toggleColor(currentColor: number[]): number[] {
14 const currentIndex = RGB_COLORS.findIndex(
15 color => color.every((val, idx) => val === currentColor[idx])
19}
20
21function App() {
22 const [color, setColor] = useState(RGB_COLORS[0]);
23 const [isFullscreen, setIsFullscreen] = useState(false);
81}
82
83function client() {
84 createRoot(document.getElementById("root")).render(<App />);
85}
87if (typeof document !== "undefined") { client(); }
88
89export default function server(request: Request): Response {
90 return new Response(
91 `

linkifyDiscordBotmain.tsx7 matches

@jamiedubs•Updated 3 months ago
5import { registerDiscordSlashCommand } from "https://esm.town/v/neverstew/registerDiscordSlashCommand";
6
7function transformLink(url: string): string {
8 try {
9 const parsedUrl = new URL(url);
19}
20
21function DiscordSetupInstructions() {
22 return (
23 <div className="setup-instructions">
66}
67
68function InstallationLinks() {
69 const [applicationId, setApplicationId] = useState(null);
70
95}
96
97function App() {
98 const [url, setUrl] = useState("");
99 const [transformedUrl, setTransformedUrl] = useState("");
153}
154
155function client() {
156 createRoot(document.getElementById("root")).render(<App />);
157}
161}
162
163export default async function server(req: Request): Promise<Response> {
164 if (req.method === "GET") {
165 const url = new URL(req.url);
270
271 if (summarize) {
272 response.data.content += "\n\nSummary functionality is not implemented in this example.";
273 }
274

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.