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//%22$%7Bad.imageUrl%7D/%22?q=api&page=1&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 25435 results for "api"(1064ms)

untitled-8620main.ts5 matches

@know•Updated 37 mins ago
271 <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
272 <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
273 <link rel="preconnect" href="https://fonts.googleapis.com">
274 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
275 <link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=Source+Sans+3:wght@400;600&display=swap" rel="stylesheet">
276<style>
277 :root {
444 const { useState, useEffect, useCallback } = React;
445
446 const API_BASE_URL = '${sourceUrl}';
447 const POLLING_INTERVAL = 2000;
448
502
503 try {
504 const response = await fetch(\`\${API_BASE_URL}/start\`, {
505 method: 'POST',
506 headers: { 'Content-Type': 'application/json' },
525 const pollJobStatus = async () => {
526 try {
527 const response = await fetch(\`\${API_BASE_URL}/status?jobId=\${jobId}\`);
528 if (!response.ok) throw new Error('Polling failed');
529

untitled-8620main.ts7 matches

@realtime•Updated 46 mins ago
81/**
82 * Main asynchronous process to build the prerequisite graph level-by-level.
83 * Tracks processed nodes to avoid redundant API calls and circular dependencies.
84 */
85async function buildTreeInBackground(jobId: string, rootNode: FactNode) {
136 });
137
138 // Wait for all API calls on the current level to complete.
139 await Promise.all(processingPromises);
140
171 <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
172 <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
173 <link rel="preconnect" href="https://fonts.googleapis.com">
174 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
175 <link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=Source+Sans+3:wght@400;600&display=swap" rel="stylesheet">
176<style>
177 :root {
344 const { useState, useEffect, useCallback } = React;
345
346 const API_BASE_URL = '${sourceUrl}';
347 const POLLING_INTERVAL = 2000;
348
419
420 try {
421 const response = await fetch(\`\${API_BASE_URL}/start\`, {
422 method: 'POST',
423 headers: { 'Content-Type': 'application/json' },
442 const pollJobStatus = async () => {
443 try {
444 const response = await fetch(\`\${API_BASE_URL}/status?jobId=\${jobId}\`);
445 if (!response.ok) throw new Error('Polling failed');
446

Townieval-summary.ts3 matches

@Skywalker•Updated 3 hours ago
18 SUM(num_images) as total_images
19 FROM ${USAGE_TABLE}
20 WHERE val_id = ? AND our_api_token = 1
21 GROUP BY val_id
22 `, [valId]);
34 FROM ${INFERENCE_CALLS_TABLE} i
35 JOIN ${USAGE_TABLE} u ON i.usage_id = u.id
36 WHERE u.val_id = ? AND u.our_api_token = 1
37 GROUP BY u.val_id
38 `, [valId]);
41 const requestsResult = await sqlite.execute(`
42 SELECT * FROM ${USAGE_TABLE}
43 WHERE val_id = ? AND our_api_token = 1
44 ORDER BY timestamp DESC
45 `, [valId]);

Townieval-detail.ts1 match

@Skywalker•Updated 3 hours ago
18 finish_reason?: string;
19 num_images?: number;
20 our_api_token: boolean;
21}
22

TownieuseUser.tsx1 match

@Skywalker•Updated 3 hours ago
1import { useState, useEffect } from "react";
2
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {

Townieuser-summary.ts2 matches

@Skywalker•Updated 3 hours ago
20 SUM(num_images) as total_images
21 FROM ${USAGE_TABLE}
22 WHERE our_api_token = 1
23 `;
24
41 FROM ${INFERENCE_CALLS_TABLE} i
42 JOIN ${USAGE_TABLE} u ON i.usage_id = u.id
43 WHERE u.our_api_token = 1
44 `;
45

Townieuser-detail.ts2 matches

@Skywalker•Updated 3 hours ago
1import { renderLayout } from "./layout.ts";
2import { formatNumber, formatPrice, formatDate, formatBoolean } from "../utils/formatters.ts";
3import { CreditAddition } from "../api/credit-additions.ts";
4
5interface UserSummaryRow {
33 finish_reason?: string;
34 num_images?: number;
35 our_api_token: boolean;
36}
37

TownieuseProject.tsx2 matches

@Skywalker•Updated 3 hours ago
1import { useState, useEffect } from "react";
2
3const PROJECT_ENDPOINT = "/api/project";
4const FILES_ENDPOINT = "/api/project-files";
5
6export function useProject(projectId: string, branchId?: string) {

TownieuseProjects.tsx1 match

@Skywalker•Updated 3 hours ago
1import { useState, useEffect } from "react";
2
3const ENDPOINT = "/api/projects-loader";
4
5export function useProjects() {

TownieuseCreditBalance.tsx1 match

@Skywalker•Updated 3 hours ago
8 const fetchBalance = async () => {
9 try {
10 const response = await fetch("/api/credit-balance");
11 if (response.ok) {
12 const data = await response.json();

PixelPixelApiMonitor1 file match

@selfire1•Updated 11 hours ago
Regularly polls the API and messages on an error.

weatherApp1 file match

@dcm31•Updated 18 hours ago
A simple weather app with dropdown cities using Open-Meteo API
fapian
<("<) <(")> (>")>
Kapil01