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/$%7Bsuccess?q=function&page=16&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 31576 results for "function"(1349ms)

statuspushover1 match

@helge•Updated 2 days ago
6
7// token, user, and other opts are as specified at https://pushover.net/api
8export async function pushover({ message, title }) {
9 console.log("Input:", { message, title });
10 console.log("Tokens:", { PUSHOVER_TOKEN, PUSHOVER_USER_KEY }); // Check if env vars are set

stopwatchscript.js4 matches

@ivobg•Updated 2 days ago
11resetBtnElem.addEventListener("click", reset);
12
13function timer () {
14 counter += 1;
15
33}
34
35function start () {
36 interval = setInterval(timer, 1000);
37}
38
39function stop () {
40 clearInterval(interval);
41 interval = null;
42}
43
44function reset () {
45 stop();
46 counter = 0;

workingNotWorkingBoardindex.ts11 matches

@dcm31•Updated 2 days ago
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4
5function getCurrentWeekString() {
6 const now = new Date();
7 const monday = new Date(now);
14}
15
16function checkForNewWeek(savedData) {
17 if (!savedData) return null;
18
46}
47
48function ItemCard({ item, category, confirmItem, moveItem, removeItem }) {
49 return (
50 <div className={`card ${item.needsConfirmation ? 'needs-confirmation' : ''}`}>
158}
159
160function AddForm({ category, newItemText, setNewItemText, addItem, onCancel }) {
161 return (
162 <div className="new-card-form">
187}
188
189function App() {
190 const [data, setData] = useState({
191 working: [],
215 }, [data]);
216
217 function addItem(category, text) {
218 const newItem = {
219 id: Date.now(),
233 }
234
235 function confirmItem(category, itemId, action = 'stay') {
236 const item = data[category].find(item => item.id === itemId);
237 if (!item) return;
258 }
259
260 function moveItem(fromCategory, toCategory, itemId) {
261 const item = data[fromCategory].find(item => item.id === itemId);
262 if (!item) return;
269 }
270
271 function removeItem(category, itemId) {
272 if (!confirm('Remove this item permanently?')) return;
273
354}
355
356function client() {
357 createRoot(document.getElementById("root")).render(<App />);
358}
362}
363
364export default async function server(request: Request): Promise<Response> {
365 return new Response(`
366 <html>

workingNotWorkingBoardweekUtils.ts2 matches

@dcm31•Updated 2 days ago
1export function getCurrentWeekString() {
2 const now = new Date();
3 const monday = new Date(now);
10}
11
12export function checkForNewWeek(savedData) {
13 if (!savedData) return null;
14

workingNotWorkingBoardCards.ts2 matches

@dcm31•Updated 2 days ago
1export function ItemCard({ item, category, confirmItem, moveItem, removeItem }) {
2 return (
3 <div className={`card ${item.needsConfirmation ? 'needs-confirmation' : ''}`}>
111}
112
113export function AddForm({ category, newItemText, setNewItemText, addItem, onCancel }) {
114 return (
115 <div className="new-card-form">

tip-calculatorscript.js1 match

@ivobg•Updated 2 days ago
15});
16
17function calculate() {
18 if (billInpElem.value && tipInpElem.value) {
19 const bill = parseFloat(billInpElem.value);

ChatApp.tsx1 match

@c15r•Updated 2 days ago
38export { DEFAULT_SYSTEM_PROMPT };
39
40export default function App() {
41 const [config, setConfig] = useState<AppConfig>({
42 anthropicApiKey: "",

ChatHTMLRenderer.tsx6 matches

@c15r•Updated 2 days ago
22 readResource: (serverName: string, uri: string) => Promise<string>;
23
24 // Utility functions
25 log: (level: "debug" | "info" | "warning" | "error", message: string, data?: any) => void;
26
40 * - Handles iframe communication via postMessage
41 */
42export default function HTMLRenderer({ html, mcpClients = [], className = "" }: HTMLRendererProps) {
43 const iframeRef = useRef<HTMLIFrameElement>(null);
44 const containerRef = useRef<HTMLDivElement>(null);
134 },
135
136 // Utility functions
137 log: (level: "debug" | "info" | "warning" | "error", message: string, data?: any) => {
138 console[level](`[HTMLRenderer] ${message}`, data);
156 }, [mcpClients, isFullscreen]);
157
158 // Fullscreen functionality
159 const enterFullscreen = useCallback(() => {
160 const container = containerRef.current;
185 const methodFunc = (mcpContext as any)[method];
186
187 if (typeof methodFunc !== "function") {
188 throw new Error(`Unknown MCP API method: ${method}`);
189 }
338 <script>
339 // Update fullscreen controls based on state
340 async function updateFullscreenControls() {
341 const controls = document.getElementById('fullscreenControls');
342 const isFs = await window.mcpContext.isFullscreen();

stravachattestDailyBrief.ts1 match

@katzenj•Updated 2 days ago
4import { DateTime } from "https://esm.sh/luxon@3.4.4";
5
6export async function testDailyBrief() {
7 try {
8 const testChatId = Deno.env.get("TEST_TELEGRAM_CHAT_ID");

stravachatsetupTelegramChatDb.ts1 match

@katzenj•Updated 2 days ago
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
5 try {
6 // Import SQLite module
tuna

tuna9 file matches

@jxnblk•Updated 2 weeks ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 2 months ago
A helper function to build a file's email
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.