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=2&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 30427 results for "function"(1906ms)

nicoFunctionScript2 file matches

@stevekrouse•Updated 1 year ago

functionZilla1 file match

@sdan•Updated 1 year ago

chatSampleFunctionExtraction2 file matches

@webup•Updated 1 year ago

chatSampleFunctionMultiple2 file matches

@webup•Updated 1 year ago

chatSampleFunctionSingle2 file matches

@webup•Updated 1 year ago

multiplicationFunctionTest1 file match

@rodrigotello•Updated 1 year ago

chatSampleFunctionTagging2 file matches

@webup•Updated 1 year ago

FunctionToHTMLForm1 file match

@rodrigotello•Updated 1 year ago

ChatHTMLRenderer.tsx6 matches

@c15r•Updated 17 mins 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);
132 },
133
134 // Utility functions
135 log: (level: "debug" | "info" | "warning" | "error", message: string, data?: any) => {
136 console[level](`[HTMLRenderer] ${message}`, data);
154 }, [mcpClients, isFullscreen]);
155
156 // Fullscreen functionality
157 const enterFullscreen = useCallback(() => {
158 const container = containerRef.current;
218 const methodFunc = (mcpContext as any)[method];
219
220 if (typeof methodFunc !== "function") {
221 throw new Error(`Unknown MCP API method: ${method}`);
222 }
365 <script>
366 // Update fullscreen controls based on state
367 async function updateFullscreenControls() {
368 const controls = document.getElementById('fullscreenControls');
369 const isFs = await window.mcpContext.isFullscreen();

honeydewmain.tsx25 matches

@legal•Updated 44 mins ago
54**Context Data:** The user's projects and tasks will be provided in a JSON string following their message.`;
55
56function generateHtmlShell(sourceUrl: string): string {
57 return `
58<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>AuraTask - AI Todo</title>
75<template id="review-task-template"><div class="review-task-item"><input type="text" class="review-task-content" placeholder="Task description" required><input type="date" class="review-task-due-date" title="Due Date"><select class="review-task-load" title="Cognitive Load"><option value="Low">Low</option><option value="Medium" selected>Medium</option><option value="High">High</option></select><button type="button" class="review-task-delete-btn" title="Remove Task">&times;</button></div></template>
76<script>
77(function() {
78 const API_URL = '${sourceUrl}';
79 const STORE_KEYS = { projects: 'aura_projects_v1', tasks: 'aura_tasks_v1' };
86 const genId = () => Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
87
88 function checkTaskLoad() {
89 if (tasks.filter(t => !t.isCompleted).length >= ACTIVE_TASK_WARNING_THRESHOLD) {
90 return confirm("You have a lot of active tasks. Are you sure you want to add more? It might be a good time to complete some items first.");
93 }
94
95 function loadState() {
96 projects = getStore(STORE_KEYS.projects);
97 tasks = getStore(STORE_KEYS.tasks);
102 }
103
104 function render() {
105 renderSidebar();
106 renderTaskList();
108 }
109
110 function toggleLoading(btn, show) {
111 if (!btn) return;
112 btn.disabled = show;
114 }
115
116 function updateUIElements() {
117 const todayStr = new Date().toISOString().split("T")[0];
118 const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr);
128 }
129
130 function renderSidebar() {
131 const mainViews = [
132 {id:'today',name:'Today',icon:'M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1z'},
137 }
138
139 function renderTaskList() {
140 const container = $("#task-list");
141 let filteredTasks = [], title = 'Tasks';
160 }
161
162 function renderChatLog() {
163 const log = $("#chat-log");
164 log.innerHTML = conversationHistory.map((msg, idx) => {
172 }
173
174 function addMessageToChat(sender, text, plan = null, requiresConfirmation = false) {
175 conversationHistory.push({ sender, text, plan, requiresConfirmation });
176 renderChatLog();
177 }
178
179 function executePlan(plan) {
180 plan.forEach(action => {
181 if (action.operation === 'CREATE_TASK') {
193 }
194
195 function handleAddTask(e) {
196 e.preventDefault();
197 if (!checkTaskLoad()) return;
206 }
207
208 function handleTaskClick(e) {
209 const target = e.target, taskItem = target.closest(".task-item");
210 if (!taskItem) return;
225 }
226
227 function openEditModal(task) {
228 $("#edit-task-id").value = task.id;
229 $("#edit-task-content").value = task.content;
234 }
235
236 function handleUpdateTask(e) {
237 e.preventDefault();
238 const taskId = $("#edit-task-id").value, task = tasks.find(t => t.id === taskId);
247 }
248
249 async function handleChatSubmit(e) {
250 e.preventDefault();
251 const input = $("#chat-input"), userMessage = input.value.trim();
270 }
271
272 function handlePlanConfirm(e) {
273 const action = e.target.dataset.planAction, idx = e.target.dataset.planIdx;
274 if (!action || !idx) return;
279 }
280
281 async function triggerProjectSynthesis() {
282 if (!checkTaskLoad()) return;
283 const goal = $("#synthesis-goal-input").value.trim();
302 }
303
304 function addReviewTaskRow(taskData = {}) {
305 const template = $('#review-task-template');
306 const clone = template.content.cloneNode(true);
313 }
314
315 function openProjectReviewModal(data) {
316 const { projectName, tasks: aiTasks } = data;
317 $('#review-project-name').value = projectName;
322 }
323
324 function handleProjectReviewSubmit(e) {
325 e.preventDefault();
326 const projectName = $('#review-project-name').value.trim();
353 }
354
355 async function triggerDailyRebalance() {
356 const todayStr = new Date().toISOString().split("T")[0];
357 const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr);
385 }
386
387 function bindEventListeners() {
388 document.body.addEventListener('click', e => {
389 if (e.target.closest('[data-view]')) {
419}
420
421export default async function(req: Request): Promise<Response> {
422 const openai = new OpenAI();
423 const url = new URL(req.url);
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.