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/$%7BsvgDataUrl%7D?q=function&page=31&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 30804 results for "function"(1236ms)

Studypoor5paid.tsx4 matches

@Aditya0010•Updated 1 day ago
31];
32
33function LoginPage() {
34 const [userId, setUserId] = useState("");
35 const [password, setPassword] = useState("");
176}
177
178function DashboardApp() {
179 const [activeSubject, setActiveSubject] = useState(null);
180
232}
233
234function client() {
235 const path = window.location.pathname;
236 if (path === "/dashboard") {
242if (typeof document !== "undefined") { client(); }
243
244export default async function server(request: Request): Promise<Response> {
245 // Comprehensive user credentials
246 const validCredentials = {

invest-trackermacro_news_daily.tsx1 match

@samxii777•Updated 1 day ago
3const KEY = Deno.env.get("NEWSAPI");
4
5export default async function run() {
6 const q = encodeURIComponent(`Fed OR CPI OR inflation OR ECB OR RBA`);
7 const url = `https://newsapi.org/v2/everything?` +

honeydewmain.tsx25 matches

@legal•Updated 1 day ago
88 `;
89
90function generateHtmlShell(sourceUrl: string): string {
91 return ` 
92 <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Honeydew</title>
473 <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> 
474 <script> 
475 (function() {
476  const API_URL = '${sourceUrl}'; 
477  const STORE_KEYS = { projects: 'honeydew_projects_v1', tasks: 'honeydew_tasks_v1', theme: 'honeydew_theme_v1' }; 
483  const genId = () => Date.now().toString(36) + Math.random().toString(36).substr(2, 9); 
484  
485  function loadState() { 
486    projects = getStore(STORE_KEYS.projects); 
487    tasks = getStore(STORE_KEYS.tasks); 
492  } 
493
494  function render() { 
495    renderSidebar(); 
496    renderTaskList(); 
498  } 
499
500  function toggleLoading(btn, show) { 
501    if (!btn) return; 
502    btn.disabled = show; 
504  } 
505  
506  function updateUIElements() { 
507    const todayStr = new Date().toISOString().split("T")[0]; 
508    const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr); 
522  } 
523
524  function renderSidebar() { 
525    const mainViews = [ 
526      {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'}, 
531  } 
532
533  function renderTaskList() { 
534    const container = $("#task-list"); 
535    let filteredTasks = [], title = 'Tasks'; 
561  } 
562
563  function renderChatLog() { 
564    const log = $("#chat-log"); 
565    log.innerHTML = conversationHistory.map(msg => { 
632  }; 
633
634 function executeSingleCommand(command) {
635 if (!command || !command.tool_name) return;
636 if (command.tool_name === 'ask_for_confirmation') {
657 }
658
659 function executeManualCommand(command) {
660 if (Array.isArray(command)) {
661 command.forEach(c => executeSingleCommand(c));
665 }
666
667  async function handleChatSubmit(e) { 
668    e.preventDefault(); 
669    const input = $("#chat-input"), userMessage = input.value.trim(); 
713  } 
714  
715  function handleAddTask(e) { 
716    e.preventDefault(); 
717    const input = $("#new-task-input"), content = input.value.trim(); 
738  } 
739
740  function handleTaskClick(e) { 
741    const target = e.target, taskItem = target.closest(".task-item"); 
742    if (!taskItem) return; 
756  } 
757
758  function openEditModal(task) { 
759    $("#edit-task-id").value = task.id; 
760    $("#edit-task-content").value = task.content; 
765  } 
766
767  function handleUpdateTask(e) { 
768    e.preventDefault(); 
769    const taskId = $("#edit-task-id").value, task = tasks.find(t => t.id === taskId); 
777  } 
778  
779  async function triggerProjectSynthesisFromButton() { 
780    const goal = prompt("Describe your new project or goal:", "Plan a launch party for a new product"); 
781    if (!goal) return; 
794  } 
795  
796  async function triggerDailyRebalance() { 
797    const todayStr = new Date().toISOString().split("T")[0]; 
798    const todayTasks = tasks.filter(t => !t.isCompleted && t.dueDate === todayStr); 
820  } 
821
822  function handleOpenChat() { 
823    const mainInput = $('#new-task-input'); 
824    const text = mainInput.value.trim(); 
833  } 
834  
835  function addReviewTaskRow(taskData = {}) { 
836    const template = $('#review-task-template'); 
837    const clone = template.content.cloneNode(true); 
844  } 
845
846  function openProjectReviewModal(data) { 
847    const { projectName, tasks: aiTasks } = data; 
848    $('#review-project-name').value = projectName; 
855  } 
856
857  function handleProjectReviewSubmit(e) { 
858    e.preventDefault(); 
859    const projectName = $('#review-project-name').value.trim(); 
877  } 
878
879 function initTheme() {
880 const themeToggle = $('#theme-toggle');
881 const storedTheme = localStorage.getItem(STORE_KEYS.theme);
897 }
898
899  function bindEventListeners() { 
900    document.body.addEventListener('click', e => { 
901      if (e.target.closest('[data-view]')) { 
953}
954
955export default async function(req: Request): Promise<Response> {
956 const openai = new OpenAI();
957 const url = new URL(req.url);

ChatEnhancedCommandPalette.tsx2 matches

@c15r•Updated 1 day ago
58}
59
60// Helper functions for JSON Schema handling
61const getDefaultValue = (schema: any): any => {
62 if (schema.default !== undefined) return schema.default;
138};
139
140export default function EnhancedCommandPalette({
141 servers,
142 query,

fart-with-aiindex.html2 matches

@sirmews•Updated 1 day ago
261 const soundWaves = document.getElementById('soundWaves');
262
263 function createSoundWave() {
264 const wave = document.createElement('div');
265 wave.className = 'wave';
271 }
272
273 function createStinkCloud() {
274 const cloud = document.createElement('div');
275 cloud.className = 'cloud';

my-first-valnew-file-1656.tsx1 match

@ccao•Updated 1 day ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(req: Request): Promise<Response> {
4 if (req.method === "OPTIONS") {
5 return new Response(null, {

my-first-val04_email.tsx1 match

@ccao•Updated 1 day ago
2// Click "Run", copy and paste the email address and send an email to it.
3// This example will log the email details received.
4export default async function emailHandler(email: Email){
5 console.log("Email received!", email.from, email.subject, email.text);
6 for (const file of email.attachments) {

my-first-val03_cron.tsx1 match

@ccao•Updated 1 day ago
2// Configure the timer with the 🕒 icon in the top right.
3// This example just logs the current time.
4export function scheduledHandler() {
5 const timestamp = new Date().toISOString();
6 console.log(`Cron val executed at: ${timestamp}`);

my-first-val02_http.tsx1 match

@ccao•Updated 1 day ago
2// Access it via its public URL (you can also pick a nicer subdomain).
3// Try adding ?name=YourName to the URL!
4export default function httpHandler(req: Request): Response {
5 const url = new URL(req.url);
6 const name = url.searchParams.get("name") || "Friend";

my-first-val01_script.tsx1 match

@ccao•Updated 1 day ago
1// This script returns a random fun fact
2// You can run scripts manually in this view or call it from other vals.
3export default function getRandomFact() {
4 const funFacts = [
5 "Honey never spoils.",
tuna

tuna9 file matches

@jxnblk•Updated 1 week ago
Simple functional CSS library for Val Town

getFileEmail4 file matches

@shouser•Updated 1 month 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.