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=67&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 11478 results for "function"(442ms)

GitHubSyncsign-webhook1 match

@MadEthan6•Updated 6 days ago
1/**
2 * Use this function along with your valtown webhook secret to create
3 * the x-val-signature header when posting to the /export webhook
4 */

GitHubSyncREADME.md1 match

@MadEthan6•Updated 6 days ago
42const url = Deno.env.get("PUSH_URL") as string;
43
44async function pushValsToGitHub() {
45 const body = "hello";
46 const signature = await sign(body, secret);

GitHubSynchome1 match

@MadEthan6•Updated 6 days ago
4import type { Context } from "npm:hono";
5
6export default async function(c: Context) {
7 return c.html(
8 <html>

GitHubSyncgithub-push1 match

@MadEthan6•Updated 6 days ago
12const valtown = new ValTown();
13
14export default async function GitHubPush(c: Context) {
15 // auth check in /index
16 const user = await valtown.me.profile.retrieve();

GitHubSynccommit-files2 matches

@MadEthan6•Updated 6 days ago
18
19/**
20 * General use function to commit files to GitHub
21 */
22export async function commitFiles({
23 token,
24 owner,

blob_adminapp.tsx7 matches

@crisscrossed•Updated 1 week ago
10}
11
12function Tooltip({ children, content }: TooltipProps) {
13 const [isVisible, setIsVisible] = useState(false);
14 const tooltipRef = useRef<HTMLDivElement>(null);
49}
50
51function formatBytes(bytes: number, decimals = 2) {
52 if (bytes === 0) return "0 Bytes";
53 const k = 1024;
58}
59
60function copyToClipboard(text: string) {
61 navigator.clipboard.writeText(text).then(() => {
62 console.log("Text copied to clipboard");
66}
67
68function ActionMenu({ blob, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
69 const [isOpen, setIsOpen] = useState(false);
70 const menuRef = useRef(null);
73
74 useEffect(() => {
75 function handleClickOutside(event) {
76 if (menuRef.current && !menuRef.current.contains(event.target)) {
77 event.stopPropagation();
155}
156
157function BlobItem({ blob, onSelect, isSelected, onDownload, onRename, onDelete, onMoveToPublic, onMoveOutOfPublic }) {
158 const [isLoading, setIsLoading] = useState(false);
159 const decodedKey = decodeURIComponent(blob.key);
216}
217
218function App({ initialEmail, initialProfile, sourceURL }) {
219 const encodeKey = (key: string) => encodeURIComponent(key);
220 const decodeKey = (key: string) => decodeURIComponent(key);

custom-jsx-runtime-starterREADME.md1 match

@jxnblk•Updated 1 week ago
19
20This points to the `jsx/jsx-runtime` module (the `jsx-runtime` name is important),
21which wraps the default React JSX runtime with a function that extracts an `sx` prop and applies it as the `style` prop.
22
23When the client module requests the `App.tsx` file from Val Town, the JSX is compiled to vanilla JavaScript to run in the browser.

steamforumscannermain.tsx15 matches

@charmaine•Updated 1 week 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: {
133}
134
135async function saveDebugHtml(gameName: string, html: string) {
136 const key = `steam_html_debug_${gameName}_${Date.now()}`;
137 await blob.set(key, html);
139}
140
141async function getStoredThreads(gameName: string): Promise<SteamThread[]> {
142 const storageKey = `steam_threads_${gameName}`;
143 return await blob.getJSON(storageKey) ?? [];
144}
145
146function identifyThreadsToNotify(currentThreads: SteamThread[], storedThreads: SteamThread[]): SteamThread[] {
147 return currentThreads.filter(currentThread => {
148 const storedThread = storedThreads.find(st => st.id === currentThread.id);
151}
152
153async function sendDiscordNotifications(
154 gameName: string,
155 threads: SteamThread[],
182}
183
184async function updateStoredThreads(gameName: string, storedThreads: SteamThread[], currentThreads: SteamThread[]) {
185 const currentThreadMap = new Map(currentThreads.map(thread => [thread.id, thread]));
186
208}
209
210function parseThreads(html: string): SteamThread[] {
211 const $ = cheerio.load(html);
212
259}
260
261function cleanTitle(title: string): string {
262 return title.replace(/\t/g, "").trim();
263}
264
265function parseForumTopic($: cheerio.Root, el: cheerio.Element): SteamThread {
266 const threadNameEl = $(el).find(".forum_topic_name");
267 const link = $(el).find(".forum_topic_overlay");
283}
284
285function parseForumTopicName($: cheerio.Root, el: cheerio.Element): SteamThread {
286 const link = $(el).find("a");
287 const url = link.attr("href") ?? "";
303}
304
305async function sendDiscordWebhook(
306 gameName: string,
307 threads: SteamThread[],

steamforumscannerREADME.md1 match

@charmaine•Updated 1 week 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",

custom-jsx-runtime-starterApp.tsx1 match

@jxnblk•Updated 1 week ago
1/** @jsxImportSource ./jsx */
2
3export function App () {
4 console.log("App");
5 return (

getFileEmail4 file matches

@shouser•Updated 1 week ago
A helper function to build a file's email

TwilioHelperFunctions

@vawogbemi•Updated 2 months ago