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=1&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 18167 results for "function"(856ms)

steamforumscannerREADME.md1 match

@luoyuchu•Updated 2 hours ago
10import scanSteamForums from "https://esm.town/v/dreww/steamforumscanner";
11
12export default async function(interval: Interval) {
13 const dota2Threads = await scanSteamForums({
14 gameName: "Dota 2",

steamforumscannermain.tsx15 matches

@luoyuchu•Updated 2 hours ago
29}
30
31async function sendErrorEmail(gameName: string, error: Error, context: string) {
32 const subject = `Error in Steam Forum Scanner for ${gameName}`;
33 const text = `An error occurred while ${context} for ${gameName}:\n\n${error.message}\n\n${error.stack}`;
41}
42
43function constructSteamUrl(steamId: string): string {
44 return `https://steamcommunity.com/app/${steamId}/discussions/`;
45}
46
47export default async function scanSteamForums({
48 gameName,
49 steamId,
98}
99
100async function cleanupDebugHtmlBlobs(gameName: string) {
101 try {
102 const debugBlobs = await blob.list(`steam_html_debug_${gameName}_`);
115}
116
117async function fetchSteamDiscussionsPage(url: string): Promise<string> {
118 const response = await fetch(url, {
119 headers: {
132}
133
134async function saveDebugHtml(gameName: string, html: string) {
135 const key = `steam_html_debug_${gameName}_${Date.now()}`;
136 await blob.set(key, html);
138}
139
140async function getStoredThreads(gameName: string): Promise<SteamThread[]> {
141 const storageKey = `steam_threads_${gameName}`;
142 return await blob.getJSON(storageKey) ?? [];
143}
144
145function identifyThreadsToNotify(currentThreads: SteamThread[], storedThreads: SteamThread[]): SteamThread[] {
146 return currentThreads.filter(currentThread => {
147 const storedThread = storedThreads.find(st => st.id === currentThread.id);
150}
151
152async function sendDiscordNotifications(
153 gameName: string,
154 threads: SteamThread[],
174}
175
176async function updateStoredThreads(gameName: string, storedThreads: SteamThread[], currentThreads: SteamThread[]) {
177 const currentThreadMap = new Map(currentThreads.map(thread => [thread.id, thread]));
178
200}
201
202function parseThreads(html: string): SteamThread[] {
203 const $ = cheerio.load(html);
204
251}
252
253function cleanTitle(title: string): string {
254 return title.replace(/\t/g, '').trim();
255}
256
257function parseForumTopic($: cheerio.Root, el: cheerio.Element): SteamThread {
258 const threadNameEl = $(el).find(".forum_topic_name");
259 const link = $(el).find(".forum_topic_overlay");
275}
276
277function parseForumTopicName($: cheerio.Root, el: cheerio.Element): SteamThread {
278 const link = $(el).find("a");
279 const url = link.attr("href") ?? "";
295}
296
297async function sendDiscordWebhook(
298 gameName: string,
299 threads: SteamThread[],

synced_reducermain.tsx1 match

@jeffreyyoung•Updated 3 hours ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 if (url.pathname === "/v1") {

templateTwitterAlertREADME.md2 matches

@divya88•Updated 3 hours ago
46- Key: `mentionsDiscord`
47- Value: Your Discord webhook URL.
48Notifications will be sent using this function:
49
50```ts
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

templateTwitterAlertmain.tsx1 match

@divya88•Updated 3 hours ago
12const isProd = false;
13
14export async function twitterAlert({ lastRunAt }: Interval) {
15 // If isProd, search for tweets since that last time this interval ran
16 // if not, search for tweets since 48 hours ago for testing

testPondiversemain1 match

@argmn•Updated 4 hours ago
6import updateTable from "./updateTable";
7
8export default async function(req: Request): Promise<Response> {
9 let url = new URL(req.url);
10 const path = url.pathname.toLowerCase();

growingEmeraldGrasshoppermain.tsx3 matches

@speedadd•Updated 4 hours ago
19- Respond in English, providing clear and direct answers`;
20
21function ChatInterface() {
22 const [messages, setMessages] = useState([]);
23 const [inputValue, setInputValue] = useState("");
415}
416
417function client() {
418 createRoot(document.getElementById("root")).render(<ChatInterface />);
419}
420if (typeof document !== "undefined") { client(); }
421
422export default async function server(request: Request): Promise<Response> {
423 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
424 try {

wonderfulBlushMagpiemain.tsx3 matches

@bgtgtgfgvbtgvgb•Updated 5 hours ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function App() {
6 const [shorts, setShorts] = useState<{id: number, link: string}[]>([]);
7 const [newShortLink, setNewShortLink] = useState('');
185}
186
187function client() {
188 createRoot(document.getElementById("root")).render(<App />);
189}
191if (typeof document !== "undefined") { client(); }
192
193export default async function handler(request: Request): Promise<Response> {
194 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
195 const KEY = "wonderfulBlushMagpie";

funAnimatedVocabularymain.tsx3 matches

@bgtgtgfgvbtgvgb•Updated 5 hours ago
119};
120
121function App() {
122 const [currentWord, setCurrentWord] = useState('');
123 const [definition, setDefinition] = useState('');
354}
355
356function client() {
357 createRoot(document.getElementById("root")).render(<App />);
358}
360if (typeof document !== "undefined") { client(); }
361
362export default async function handler(request: Request): Promise<Response> {
363 if (request.method === 'GET') {
364 return new Response(`

replicache-forknew-file-8157.tsx1 match

@jeffreyyoung•Updated 5 hours ago
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 if (url.pathname === "/v1") {

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": "*",