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/$1?q=api&page=34&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 20231 results for "api"(3021ms)

stevensDemoApp.tsx8 matches

@TheyClonedMe•Updated 3 days ago
10import { NotebookView } from "./NotebookView.tsx";
11
12const API_BASE = "/api/memories";
13const MEMORIES_PER_PAGE = 20; // Increased from 7 to 20 memories per page
14
90
91 // Fetch avatar image
92 fetch("/api/images/stevens.jpg")
93 .then((response) => {
94 if (response.ok) return response.blob();
104
105 // Fetch wood background
106 fetch("/api/images/wood.jpg")
107 .then((response) => {
108 if (response.ok) return response.blob();
133 setError(null);
134 try {
135 const response = await fetch(API_BASE);
136 if (!response.ok) {
137 throw new Error(`HTTP error! status: ${response.status}`);
176
177 try {
178 const response = await fetch(API_BASE, {
179 method: "POST",
180 headers: { "Content-Type": "application/json" },
199
200 try {
201 const response = await fetch(`${API_BASE}/${id}`, {
202 method: "DELETE",
203 });
231
232 try {
233 const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
234 method: "PUT",
235 headers: { "Content-Type": "application/json" },
606 <div className="font-pixel text-[#f8f1e0]">
607 <style jsx>{`
608 @import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap");
609
610 @tailwind base;

llm-tipsexample.html16 matches

@cricks_unmixed4u•Updated 3 days ago
72 class="method-btn px-4 py-2 rounded-lg border-2 border-gray-300 bg-white text-gray-700 font-medium cursor-pointer transition-all hover:border-gray-400"
73 >
74 Method B: Supadata API
75 </button>
76 <button
110 <div id="yt-transcript-method" class="method-content bg-gray-100 p-6 rounded-lg mb-6 hidden">
111 <p class="text-base text-gray-600 mb-4">
112 Use Supadata's API to get YouTube transcripts programmatically:
113 </p>
114
115 <div class="mb-4">
116 <label for="apiKey" class="block text-sm font-medium text-gray-700 mb-2">
117 Supadata API Key:
118 </label>
119 <input
120 type="password"
121 id="apiKey"
122 placeholder="sd_your_api_key_here"
123 class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
124 />
125 <p class="text-xs text-gray-500 mt-1">
126 Get your API key from <a href="https://supadata.ai" target="_blank" class="text-blue-600 underline">supadata.ai</a>
127 </p>
128 </div>
162 <div class="mt-4 p-3 bg-blue-50 rounded border-l-4 border-blue-400">
163 <p class="text-sm text-blue-700">
164 <strong>Tip:</strong> This API method gives you clean transcript data that you can pipe directly into vim or save to a file for processing.
165 </p>
166 </div>
180 <div class="flex justify-between items-center">
181 <div>
182 <h5 class="font-medium">OpenAI Whisper API</h5>
183 <p class="text-sm text-gray-600">Direct audio transcription using Whisper</p>
184 </div>
302
303 function generateCurlCommand() {
304 const apiKey = document.getElementById('apiKey').value;
305 const youtubeUrl = document.getElementById('youtubeUrl').value;
306
307 if (!apiKey || !youtubeUrl) {
308 alert('Please enter both API key and YouTube URL');
309 return;
310 }
311
312 const curlCommand = `curl -X GET 'https://api.supadata.ai/v1/youtube/transcript?url=${encodeURIComponent(youtubeUrl)}&text=true' \\
313 -H 'x-api-key: ${apiKey}'`;
314
315 document.getElementById('curlCommand').textContent = curlCommand;
361{ NEW YOUTUBE SOURCE
362
363Excerpts from the transcript of the video "AI Snake Oil: What Artificial Intelligence Can Do, What It Can't, and How to Tell the Difference" uploaded on the YouTube channel "MIT Shaping the Future of Work Initiative":
364
365[1] ASU OZDAGLAR: Maybe we should get started, right? Hi, everyone. It's a pleasure to welcome you all to tonight's talk with Professor Arvind Narayanan. The Schwarzman College of Computing is honored to co-host this event with MIT's Shaping the Future of Work Initiative...</pre>
366 </div>
367

medmain.tsx7 matches

@svc•Updated 3 days ago
264const generateHtml = (sourceUrl) => {
265 const styles = `
266 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Mono&family=Lobster+Two:ital,wght@1,700&display=swap');
267 :root {
268 --bg-color: #111827; --card-bg: #1F2937; --nav-bg: rgba(17, 24, 39, 0.7); --border-color: #374151;
368 <script type="module">
369 const $ = s => document.querySelector(s);
370 const API_URL = '${sourceUrl}';
371 const mainContent = $('#main-content');
372 const patientBanner = $('#patient-banner');
563 mainContent.innerHTML = '<div class="loading-indicator">Analyzing & Executing...</div>';
564 try {
565 const res = await fetch(API_URL, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ endpoint: 'full-process', command: commandText, patientContext: patientContext }) });
566 const data = await res.json();
567 if (!res.ok) throw new Error(data.error || 'API request failed.');
568 patientContext = data.patientContext || {};
569 renderPatientBanner();
638 renderSection = (title, content, itemRenderer) => { if (!content || (Array.isArray(content) && content.length === 0)) return ''; const itemsHtml = Array.isArray(content) ? '<ul>' + content.map(item => itemRenderer ? itemRenderer(item) : \`<li>\${escapeHtml(item)}</li>\`).join('') + '</ul>' : \`<p>\${itemRenderer ? itemRenderer(content) : escapeHtml(String(content)).replace(/\\n/g, '<br>')}</p>\`; return \`<div class="result-section"><h4>\${title}</h4>\${itemsHtml}</div>\`; };
639 renderResult = (task, result, container) => { let html = ''; let isCrisis = false; switch(task) { case 'PREOP': if (result.assessment || result.plan) { html += \`<h2 class="result-title">Pre-Operative Assessment</h2>\`; html += renderSection('Patient Summary', result.assessment?.patientSummary); html += renderSection('Procedure', result.assessment?.procedure, formatDynamicField); html += renderSection('Key Anesthetic Risks', result.assessment?.keyRisks, item => \`<li><strong>\${escapeHtml(item.risk)}:</strong> \${escapeHtml(item.rationale)}</li>\`); html += renderSection('Anesthetic Type', result.plan?.anestheticType); html += renderSection('Monitoring Plan', result.plan?.monitoring); html += renderSection('Medication Management', result.plan?.medicationManagement); } else if (result.summary) { html += \`<h2 class="result-title">Pre-Operative Summary</h2>\`; html += renderSection('Summary', result.summary); } else { html += '<div class="error-msg">Could not generate a pre-operative assessment from the provided information.</div>'; } break; case 'DRUG': html += \`<h2 class="result-title">Drug Info: \${formatDynamicField(result.drug)}</h2>\`; for (const [key, value] of Object.entries(result)) { if (key === 'drug' || key === 'disclaimer') continue; if (value) { html += renderSection(formatKey(key), value, renderDynamicNode); } } break; case 'PLAN': html += \`<h2 class="result-title">Anesthetic Plan: \${formatDynamicField(result.focus) || escapeHtml(patientContext.procName)}</h2>\`; if (result.planByPhase) { html += renderSection('Premedication', result.planByPhase.premedication); html += renderSection('Induction', result.planByPhase.induction); html += renderSection('Maintenance', result.planByPhase.maintenance); html += renderSection('Emergence', result.planByPhase.emergence); html += renderSection('Post-Operative Care', result.planByPhase.postOp); } html += renderSection('Contingency Planning', result.contingencyPlanning, item => \`<li><strong>\${escapeHtml(item.problem)}:</strong><ul>\${(item.strategy || []).map(s => \`<li>\${escapeHtml(s)}</li>\`).join('')}</ul></li>\`); break; case 'GUIDELINE': html += \`<h2 class="result-title">Guideline: \${formatDynamicField(result.topic)}</h2>\`; html += renderSection('Key Recommendations', result.keyRecommendations, item => \`<li>\${escapeHtml(item.recommendation)} \${item.strength ? \`(<em>\${escapeHtml(item.strength)}</em>)\` : ''}</li>\`); if (result.sourceUrl) html += \`<div class="result-section"><h4>Source</h4><p><a href="\${result.sourceUrl}" target="_blank">\${result.sourceUrl}</a></p></div>\`; break; case 'CHECKLIST': html += \`<h2 class="result-title">Checklist: \${formatDynamicField(result.title)}</h2>\`; html += renderSection('Items', result.items, item => \`<div class="checklist-item" id="\${item.id}" onclick="this.classList.toggle('checked')"><input type="checkbox"><label for="cb-\${item.id}">\${escapeHtml(item.label)}</label></div>\`); break; case 'CRISIS': isCrisis = true; html += \`<h2 class="result-title crisis-title">CRISIS: \${formatDynamicField(result.crisisName)}</h2>\`; html += renderSection('1. Initial Steps', result.initialSteps); html += renderSection('2. Treatment Protocol', result.treatmentProtocol, item => \`<li><strong>\${escapeHtml(item.step)}:</strong> \${escapeHtml(item.details)} \${item.drugDose ? \`<strong>[\${escapeHtml(item.drugDose)}]</strong>\` : ''}</li>\`); html += renderSection('3. Follow-up Care', result.followUpCare); break; case 'HELP': html += \`<h2 class="result-title">\${escapeHtml(result.title)}</h2>\`; html += \`<p>\${escapeHtml(result.description)}</p>\`; html += renderSection('Available Commands', result.commands, item => \`<li><strong>\${escapeHtml(item.name)}:</strong> \${escapeHtml(item.usage)}<br><small><em>Example: "\${escapeHtml(item.example)}"</em></small></li>\`); break; case 'DIAG': conversationState = { history: [], lastResponse: null, sign: result.sign }; html += \`<h2 class="result-title">Differential Diagnosis for: \${escapeHtml(result.sign)}</h2>\`; html += renderSection('Initial Actions', result.initialActions); html += \`<div class="result-section diag-pathway-section"></div>\`; break; default: html = \`<h2 class="result-title">\${task}</h2><pre>\${escapeHtml(JSON.stringify(result, null, 2))}</pre>\`; } container.innerHTML = \`<div class="result-container \${isCrisis ? 'crisis-container' : ''}">\${html}<p class="disclaimer"><strong>Disclaimer:</strong> \${escapeHtml(result.disclaimer)}</p></div>\`; if (task === 'DIAG' && result.interactivePathway) renderDiagPathway(container.querySelector('.diag-pathway-section'), result.interactivePathway); };
640 renderDiagPathway = (element, pathway) => { const onOptionClick = async (option) => { element.innerHTML = '<div class="loading-indicator">Thinking...</div>'; conversationState.history.push({ question: pathway.initialQuestion, options: pathway.options.map(o => o.response) }); conversationState.lastResponse = option.response; const res = await fetch(API_URL, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ endpoint: 'follow-up', task: 'DIAG', patientContext: patientContext, conversationState: conversationState }) }); const data = await res.json(); if (!res.ok) { element.innerHTML = \`<div class="error-msg">\${data.error || 'Follow-up failed.'}</div>\`; return; } renderDiagPathway(element, data.result.interactivePathway); }; let html = \`<p><strong>\${escapeHtml(pathway.initialQuestion)}</strong></p><div class="diag-pathway-options">\`; pathway.options.forEach(opt => { if (opt.differential && !opt.followUpQuestion) { html += \`<div><strong>Final Differential: \${escapeHtml(opt.differential)}</strong><p>\${escapeHtml(opt.rationale)}</p></div>\`; } else { html += \`<button class="diag-option-btn">\${escapeHtml(opt.response)}</button>\`; } }); element.innerHTML = html + '</div>'; element.querySelectorAll('.diag-option-btn').forEach((btn, i) => btn.addEventListener('click', () => onOptionClick(pathway.options[i]))); };
641
642 </script>
648 log("DEBUG", "LLM", `Calling OpenAI for TID ${tid}`);
649 try {
650 const oa = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
651 const completion = await oa.chat.completions.create({
652 model,
659 return JSON.parse(content);
660 } catch (err) {
661 log("ERROR", "LLM", `OpenAI API call failed for TID ${tid}`, { error: err.message });
662 throw new Error(`AI model error: ${err.message}`);
663 }

reactHonoStarterindex.ts2 matches

@Crypto•Updated 3 days ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

untitled-8093main.tsx5 matches

@Crypto•Updated 3 days ago
10| **Wallet Integration** | Connect users’ wallets (ERC-20 for deposits, TRC-20 for withdrawals) with ownership verification via digital signatures. |
11| **Deposits and Withdrawals** | Support for ERC-20 token deposits and TRC-20 withdrawals with live exchange rates and transaction status updates. |
12| **Market Value Tracking** | Real-time price feed for major cryptocurrencies via APIs (e.g., CoinGecko, CoinMarketCap). |
13| **Mining Pool Integration** | Backend based on open-source projects like Multicoin-co’s node-open-mining-portal, supporting multi-coin mining with real-time monitoring. |
14| **VIP Reward System** | Tiered membership based on investment, offering exclusive perks like priority mining allocation and increased reward shares. |
16| **Transaction/Reward Logging On-Chain** | All transactions logged on Ethereum and Tron blockchains for transparency. |
17| **Dashboard** | User interface displaying wallet balances, mining stats, transaction history, and notifications. |
18| **Security** | Encrypted data storage, multi-factor authentication (MFA), HTTPS/TLS, secure API endpoints. |
19| **Responsive Design** | Fully functional on desktop and mobile browsers with seamless UX/UI. |
20
24|---------------------|------------------------------------------------------------------------------------|
25| **Frontend** | React.js (Next.js for SSR), Web3.js/Ethers.js for wallet interactions, Tailwind CSS or Chakra UI for styling. |
26| **Backend** | Node.js with Express/Koa, GraphQL API for efficient data queries. |
27| **Blockchain** | Ethereum (ERC-20) smart contracts in Solidity for deposits and rewards; Tron for TRC-20 withdrawals. |
28| **Database** | PostgreSQL or MongoDB for user data and mining stats. |
29| **Market Data API** | CoinGecko API or CoinMarketCap API for live crypto prices. |
30| **Mining Pool Backend** | Fork and customize [node-open-mining-portal](https://github.com/Multicoin-co/node-open-mining-portal). |
31| **Authentication** | JWT-based system with OAuth integrations, MFA via authenticator apps or SMS/Email OTP. |
88
89- **Mining Pools:** [NiceHash](https://www.nicehash.com), [ViaBTC](https://www.viabtc.com)
90- **Market Data APIs:** [CoinGecko](https://www.coingecko.com/en/api), [CoinMarketCap](https://coinmarketcap.com/api/)
91- **Wallet SDKs:** [Ethers.js](https://docs.ethers.io/v5/), [TronLink](https://www.tronlink.org/)
92

currencymain.tsx2 matches

@luizhrios•Updated 3 days ago
6
7export let currency = async (desired, base = "usd", amount = 1) => {
8 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
9 if (false && rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
10 else {
11 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
12 console.log("desired", rates[desired.toLowerCase()]);
13 console.log("base", rates[base.toLowerCase()]);

Glimpsedatabase.controller.ts1 match

@glance•Updated 3 days ago
3// Initialize Notion client
4const notion = new Client({
5 auth: Deno.env.get("NOTION_API_KEY"),
6});
7

Glimpsedatabase.api.routes.ts0 matches

@glance•Updated 3 days ago
1import { Hono } from "npm:hono";
2import { getDatabase } from "../../controllers/database.controller.ts";
3
4const app = new Hono();
5

GlimpsedemosToCache.controller.ts1 match

@glance•Updated 3 days ago
3// Initialize Notion client
4const notion = new Client({
5 auth: Deno.env.get("NOTION_API_KEY"),
6});
7

sqliteExplorerAppREADME.md1 match

@connnolly•Updated 3 days ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

somisomi-api-server-v2

@somi_dev•Updated 14 hours ago

googleGeminiAPI2 file matches

@goddesstex•Updated 1 day ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)