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/$2?q=api&page=1390&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 17891 results for "api"(5877ms)

basicAuthREADME.md1 match

@a4v2d4•Updated 6 months ago
17```
18
19If you want to use an apiToken as a password:
20
21```ts

assertiveTanMeadowlarkREADME.md1 match

@gwthompson•Updated 6 months ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

passwordGenmain.tsx11 matches

@all•Updated 6 months ago
157 const [policy, setPolicy] = useState({
158 minLength: 12,
159 requireCapital: true,
160 requireSpecial: true,
161 allowedSpecial: "!@#$%^&*()_+-=[]{}|;:,.<>?",
174 ...policy,
175 minLength: 8,
176 requireCapital: false,
177 requireSpecial: false,
178 });
182 ...policy,
183 minLength: 12,
184 requireCapital: true,
185 requireSpecial: true,
186 });
190 ...policy,
191 minLength: 16,
192 requireCapital: true,
193 requireSpecial: true,
194 });
292 <input
293 type="checkbox"
294 id="requireCapital"
295 checked={policy.requireCapital}
296 onChange={(e) => setPolicy({ ...policy, requireCapital: e.target.checked })}
297 className="w-5 h-5 text-green-600"
298 />
299 <label htmlFor="requireCapital" className="text-lg">Require Capital Letter</label>
300 </div>
301 <div className="flex items-center space-x-2">
453 <meta name="viewport" content="width=device-width, initial-scale=1.0">
454 <title>Advanced Password Generation System</title>
455 <link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&display=swap" rel="stylesheet">
456 <script src="https://cdn.tailwindcss.com"></script>
457 <script>
586 password = password.slice(0, insertIndex) + securePhrase + password.slice(insertIndex);
587
588 // Ensure capital letter if required
589 if (policy.requireCapital && !/[A-Z]/.test(password)) {
590 const index = Math.floor(Math.random() * password.length);
591 password = password.slice(0, index) + password[index].toUpperCase() + password.slice(index + 1);

fullPageWebsiteScrapermain.tsx4 matches

@willthereader•Updated 6 months ago
78 console.log("Debug - Full query being sent:", query);
79
80 console.log(`Making LSD API request for ${websiteUrl}`);
81 const response = await fetch(
82 `https://lsd.so/api?query=${encodeURIComponent(query)}`,
83 );
84
161 a`;
162
163 console.log(`Making LSD API request for ${pageUrl}`);
164 const response = await fetch(
165 `https://lsd.so/api?query=${encodeURIComponent(pageQuery)}`,
166 );
167

htmlToMarkdownConvertermain.tsx1 match

@willow•Updated 6 months ago
114 <title>HTML to Markdown Converter (with Table and Link Support)</title>
115 <meta name="viewport" content="width=device-width, initial-scale=1">
116 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
117 <style>${css}</style>
118 </head>

sqliteExplorerAppREADME.md1 match

@jaip•Updated 6 months 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

sqliteExplorerAppmain.tsx2 matches

@jaip•Updated 6 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

xmasRedHamstermain.tsx2 matches

@trollishka•Updated 6 months ago
27
28async function getMostPopularPinterestImage(query: string): Promise<string> {
29 const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30 const response = await fetch(searchUrl, {
31 headers: {
36
37 if (!response.ok) {
38 throw new Error(`Pinterest API request failed: ${response.statusText}`);
39 }
40

xmasRedHamstermain.tsx2 matches

@stevekrouse•Updated 6 months ago
27
28async function getMostPopularPinterestImage(query: string): Promise<string> {
29 const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30 const response = await fetch(searchUrl, {
31 headers: {
36
37 if (!response.ok) {
38 throw new Error(`Pinterest API request failed: ${response.statusText}`);
39 }
40

tokencountermain.tsx36 matches

@prashamtrivedi•Updated 7 months ago
10 const [modelFamily, setModelFamily] = useState("Anthropic");
11 const [tokenCount, setTokenCount] = useState(null);
12 const [anthropicApiKey, setAnthropicApiKey] = useState("");
13 const [geminiApiKey, setGeminiApiKey] = useState("");
14 const [isLoading, setIsLoading] = useState(false);
15
16 useEffect(() => {
17 const storedAnthropicKey = localStorage.getItem("anthropicApiKey");
18 const storedGeminiKey = localStorage.getItem("geminiApiKey");
19 if (storedAnthropicKey) setAnthropicApiKey(storedAnthropicKey);
20 if (storedGeminiKey) setGeminiApiKey(storedGeminiKey);
21 }, []);
22
23 const saveApiKey = (key, value) => {
24 localStorage.setItem(key, value);
25 };
26
27 const handleApiKeyChange = (e, setFunction, storageKey) => {
28 const value = e.target.value;
29 setFunction(value);
30 saveApiKey(storageKey, value);
31 };
32
33 const countTokens = async () => {
34 if (modelFamily === "Anthropic" && anthropicApiKey) {
35 try {
36 const response = await fetch("/api/count-tokens", {
37 method: "POST",
38 headers: {
40 },
41 body: JSON.stringify({
42 apiKey: anthropicApiKey,
43 systemPrompt,
44 userPrompt,
55 return 0;
56 }
57 } else if (modelFamily === "Google Gemini" && geminiApiKey) {
58 try {
59 const genAI = new GoogleGenerativeAI(geminiApiKey);
60 const modelOptions = {
61 model: "models/gemini-1.5-pro",
83 }
84 } else {
85 // Fallback to simple word count when API keys are not available
86 return (systemPrompt + userPrompt + tools).split(/\s+/).length;
87 }
95 }
96
97 if (modelFamily === "Anthropic" && !anthropicApiKey) {
98 alert("Please provide your Anthropic API key.");
99 return;
100 }
101
102 if (modelFamily === "Google Gemini" && !geminiApiKey) {
103 alert("Please provide your Google Gemini API key.");
104 return;
105 }
111 } catch (error) {
112 console.error("Error:", error);
113 alert("An error occurred while processing your request. Please check your API key and try again.");
114 } finally {
115 setIsLoading(false);
169 {modelFamily === "Anthropic" && (
170 <div>
171 <label htmlFor="anthropicApiKey" className="block text-purple-300 mb-2">Anthropic API Key:</label>
172 <input
173 type="password"
174 id="anthropicApiKey"
175 value={anthropicApiKey}
176 onChange={(e) => handleApiKeyChange(e, setAnthropicApiKey, "anthropicApiKey")}
177 placeholder="Enter your Anthropic API key"
178 className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
179 />
182 {modelFamily === "Google Gemini" && (
183 <div>
184 <label htmlFor="geminiApiKey" className="block text-purple-300 mb-2">Google Gemini API Key:</label>
185 <input
186 type="password"
187 id="geminiApiKey"
188 value={geminiApiKey}
189 onChange={(e) => handleApiKeyChange(e, setGeminiApiKey, "geminiApiKey")}
190 placeholder="Enter your Google Gemini API key"
191 className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
192 />
225 const url = new URL(request.url);
226
227 if (url.pathname === "/api/count-tokens") {
228 if (request.method !== "POST") {
229 return new Response("Method Not Allowed", { status: 405 });
231
232 const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
233 const { apiKey, systemPrompt, userPrompt, tools } = await request.json();
234
235 const anthropic = new Anthropic({ apiKey });
236 const countRequest = {
237 betas: ["token-counting-2024-11-01"],
264 }
265
266 if (url.pathname === "/api/generate-anthropic") {
267 if (request.method !== "POST") {
268 return new Response("Method Not Allowed", { status: 405 });
270
271 const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
272 const { apiKey, systemPrompt, userPrompt } = await request.json();
273
274 const anthropic = new Anthropic({ apiKey });
275
276 try {

dailyQuoteAPI

@Souky•Updated 1 day ago

HTTP

@Ncharity•Updated 1 day ago
Daily Quote API
apiry
Kapil01