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/?q=function&page=923&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 18181 results for "function"(2019ms)

cerebras_coderindex7 matches

@notaproโ€ขUpdated 2 months ago
23);
24
25function Hero({
26 prompt,
27 setPrompt,
44
45 <p className="text-[#bababa] text-center max-w-[25ch] mx-auto my-4 font-dm-sans">
46 Turn your ideas into fully functional apps in{" "}
47 <span className="relative w-fit text-fuchsia-400 z-10 italic font-semibold rounded-full">
48 less than a second
115}
116
117function App() {
118 const previewRef = React.useRef<HTMLDivElement>(null);
119 const [prompt, setPrompt] = useState("");
169 });
170
171 function handleStarterPromptClick(promptItem: typeof prompts[number]) {
172 setLoading(true);
173 setTimeout(() => handleSubmit(promptItem.prompt), 0);
174 }
175
176 async function handleSubmit(e: React.FormEvent | string) {
177 if (typeof e !== "string") {
178 e.preventDefault();
225 }
226
227 function handleVersionChange(direction: "back" | "forward") {
228 const { currentVersionIndex, versions } = versionHistory;
229 if (direction === "back" && currentVersionIndex > 0) {
973);
974
975function client() {
976 const path = window.location.pathname;
977 const root = createRoot(document.getElementById("root")!);

cerebras_codergenerate-code2 matches

@notaproโ€ขUpdated 2 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) {

webdavwebdav.ts1 match

@pomdtrโ€ขUpdated 2 months ago
7};
8
9export function webdavServer(
10 req: Request,
11 options?: WebdavOptions,

webdavmain.ts1 match

@pomdtrโ€ขUpdated 2 months ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

serveValsmain.tsx1 match

@pomdtrโ€ขUpdated 2 months ago
7};
8
9export function serveVals(
10 req: Request,
11 options?: WebdavOptions,

valentinemain.tsx3 matches

@kemkemโ€ขUpdated 2 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 `

genuineBrownBoobymain.tsx11 matches

@sdevanairโ€ขUpdated 2 months ago
3import ReactDOM from "https://esm.sh/react-dom@18.2.0/client";
4
5// Utility Functions
6const HABIT_ICONS = {
7 fitness: "๐Ÿ’ช", reading: "๐Ÿ“–", meditation: "๐Ÿง˜",
17
18// AI-Powered Motivation Generation
19async function generateMotivation(userProgress) {
20 try {
21 const { OpenAI } = await import("https://esm.town/v/std/openai");
38
39// Voice Input Component
40function VoiceInput({ onComplete }) {
41 const [isListening, setIsListening] = useState(false);
42 const recognitionRef = useRef(null);
97
98// Main Habit Tracker Component
99function HabitTracker() {
100 const [habits, setHabits] = useState([]);
101 const [newHabit, setNewHabit] = useState('');
116 }, [darkMode]);
117
118 async function fetchHabits() {
119 try {
120 const response = await fetch('/get-habits');
128 }
129
130 function calculateUserProgress(habitList) {
131 const totalHabits = habitList.length;
132 const completedHabits = habitList.filter(h => h.streak > 0).length;
151 }
152
153 async function addHabit() {
154 if (!newHabit.trim()) return;
155
173 }
174
175 async function completeHabit(habitId) {
176 try {
177 const response = await fetch('/complete-habit', {
189 }
190
191 function determineBadge(streak) {
192 if (streak >= BADGE_THRESHOLDS.legend) return "๐Ÿ† Legend";
193 if (streak >= BADGE_THRESHOLDS.champion) return "๐Ÿฅ‡ Champion";
287
288// Client initialization with error handling
289function client() {
290 try {
291 const rootElement = document.getElementById("root");
305}
306
307export default async function server(request: Request): Promise<Response> {
308 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
309 const KEY = "genuineBrownBooby";

habitTrackerAppmain.tsx11 matches

@sdevanairโ€ขUpdated 2 months ago
3import ReactDOM from "https://esm.sh/react-dom@18.2.0/client";
4
5// Utility Functions
6const HABIT_ICONS = {
7 fitness: "๐Ÿ’ช", reading: "๐Ÿ“–", meditation: "๐Ÿง˜",
17
18// AI-Powered Motivation Generation
19async function generateMotivation(userProgress) {
20 try {
21 const { OpenAI } = await import("https://esm.town/v/std/openai");
38
39// Voice Input Component
40function VoiceInput({ onComplete }) {
41 const [isListening, setIsListening] = useState(false);
42 const recognitionRef = useRef(null);
97
98// Main Habit Tracker Component
99function HabitTracker() {
100 const [habits, setHabits] = useState([]);
101 const [newHabit, setNewHabit] = useState('');
116 }, [darkMode]);
117
118 async function fetchHabits() {
119 try {
120 const response = await fetch('/get-habits');
128 }
129
130 function calculateUserProgress(habitList) {
131 const totalHabits = habitList.length;
132 const completedHabits = habitList.filter(h => h.streak > 0).length;
151 }
152
153 async function addHabit() {
154 if (!newHabit.trim()) return;
155
173 }
174
175 async function completeHabit(habitId) {
176 try {
177 const response = await fetch('/complete-habit', {
189 }
190
191 function determineBadge(streak) {
192 if (streak >= BADGE_THRESHOLDS.legend) return "๐Ÿ† Legend";
193 if (streak >= BADGE_THRESHOLDS.champion) return "๐Ÿฅ‡ Champion";
287
288// Client initialization with error handling
289function client() {
290 try {
291 const rootElement = document.getElementById("root");
305}
306
307export default async function server(request: Request): Promise<Response> {
308 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
309 const KEY = "habitTrackerApp";

forkyApp.tsx1 match

@shouserโ€ขUpdated 2 months ago
2import { useState } from "https://esm.sh/react@18.2.0";
3
4export function App() {
5 const [projectUrl, setProjectUrl] = useState("");
6 const [apiToken, setApiToken] = useState("");

cabinAdjacentTweetsmain.tsx14 matches

@jonboโ€ขUpdated 2 months ago
115const openai = new OpenAI();
116
117async function isTweetProcessed(tweetId: string): Promise<boolean> {
118 const result = await sqlite.execute({
119 sql: "SELECT tweetId FROM cabinAdjacentTweets WHERE tweetId = :tweetId",
123}
124
125async function markTweetAsProcessed(tweetId: string, tweetText: string): Promise<void> {
126 await sqlite.execute({
127 sql:
135}
136
137// Core API functions
138async function searchTweets(query: string, startTime: Date): Promise<Tweet[]> {
139 try {
140 console.log(`Making request to socialdata API with query: ${query}`);
199}
200
201async function getUserTweets(username: string, startTime: Date): Promise<Tweet[]> {
202 try {
203 // For user tweets, we can use the search endpoint with from: operator
259}
260
261// Search functions
262const KEYWORD_CHUNKS = [
263 "\"improve community\" OR \"improve neighborhood\" OR \"best neighborhood\" OR \"friends far\" OR \"walkable neighborhood\"",
267];
268
269async function scanKeywords(startTime: Date): Promise<Tweet[]> {
270 console.log("Starting keyword scan...");
271 const allTweets: Tweet[] = [];
287}
288
289async function scanAccounts(startTime: Date): Promise<Tweet[]> {
290 console.log("Starting account scan...");
291 const BATCH_SIZE = 5;
312
313// Retry helper with exponential backoff
314async function retryWithBackoff<T>(
315 operation: () => Promise<T>,
316 maxRetries: number = 5,
337
338// Assessment and processing
339async function assessTweet(tweet: string): Promise<Assessment> {
340 try {
341 const completion = await retryWithBackoff(() =>
401}
402
403async function sendToDiscord(tweet: Tweet, webhookUrl: string): Promise<void> {
404 const content = `https://x.com/${tweet.user.screen_name}/status/${tweet.id_str}`;
405 await discordWebhook({
410
411// Main processing pipeline
412async function processTweets(tweets: Tweet[]) {
413 for (const tweet of tweets) {
414 try {
439}
440
441// Main function
442export async function twitterAlert({ lastRunAt }: { lastRunAt: string }) {
443 console.log("Starting Twitter alert scan...");
444 const startTime = new Date(Date.parse(lastRunAt) - 1000 * 60 * 60);

getFileEmail4 file matches

@shouserโ€ขUpdated 1 week ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblkโ€ขUpdated 2 weeks ago
Simple functional CSS library for Val Town
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
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": "*",