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/$%7Bart_info.art.src%7D?q=api&page=936&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 12646 results for "api"(2484ms)

githubactivitysummarizermain.tsx8 matches

@ejfox•Updated 9 months ago
1// This approach fetches GitHub activity for two users specified in the URL,
2// sends it to OpenAI for analysis, and returns collaboration suggestions.
3// It uses the GitHub API (which doesn't require authentication for public data)
4// and the OpenAI API (which does require an API key).
5// Tradeoff: We're using an inline API key for simplicity, which isn't ideal for security.
6// Note: This might hit rate limits for the GitHub API due to fetching a year of data.
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9
10const OPENAI_API_KEY = "your_openai_api_key"; // Replace with your actual OpenAI API key
11
12export default async function main(req: Request): Promise<Response> {
17 async function fetchUserActivity(username: string) {
18 const oneYearAgo = new Date(Date.now() - 365 * 24 * 60 * 60 * 1000).toISOString();
19 const response = await fetch(`https://api.github.com/users/${username}/events?per_page=100&since=${oneYearAgo}`);
20 const data = await response.json();
21 if (!Array.isArray(data)) {
22 throw new Error(`Unexpected GitHub API response for user ${username}`);
23 }
24 return data;
54 const user2Summary = summarizeActivity(user2Data);
55
56 const openai = new OpenAI(OPENAI_API_KEY);
57 const completion = await openai.chat.completions.create({
58 model: "gpt-3.5-turbo",

relationshipgeneratormain.tsx2 matches

@ejfox•Updated 9 months ago
1// This val receives text input, sends it to OpenAI to generate relationships,
2// and returns a newline-delimited list of relationships.
3// It uses the OpenAI API to generate the relationships.
4// Tradeoff: This approach relies on an external API, which may have rate limits or costs.
5
6// Usage with curl:

githubactivitymain.tsx3 matches

@ejfox•Updated 9 months ago
1// This approach uses the GitHub API without authentication, which is subject to rate limiting.
2// We'll fetch and process the GitHub activity data, and render it as a nicely designed website
3// using Vue for templating and Tailwind for styling.
9
10async function fetchGitHubEvents(username: string) {
11 const response = await fetch(`https://api.github.com/users/${username}/events/public`, {
12 headers: {
13 "User-Agent": "Val-Town-Script",
15 });
16 if (!response.ok) {
17 throw new Error(`GitHub API request failed: ${response.status}`);
18 }
19 return await response.json();

starterThememain.tsx1 match

@iamseeley•Updated 9 months ago
1export const starterTheme = {
2 fontLink: `<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">`,
3 styles: `
4 /* General styles */

MiauFoodmain.tsx4 matches

@mauriciobc•Updated 9 months ago
66 <title>Lista de alimentação</title>
67 <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
68 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
69 <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
70 <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
71 <style>
160 <title>Já Comeu?</title>
161 <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
162 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
163 <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
164 <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
165 <style>

sqlitemain.tsx3 matches

@maxm•Updated 9 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

mortage_rate_drop_emailmain.tsx4 matches

@alm•Updated 9 months ago
3// 4.1%
4const maximumMortageRate = 4.1;
5const fredApiKey = Deno.env.get("FRED_API_SECRET_KEY");
6const fredApiUrl =
7 `https://api.stlouisfed.org/fred/series/observations?series_id=MORTGAGE30US&api_key=${fredApiKey}&file_type=json&sort_order=desc&limit=1`;
8
9export default async function main(req: Request) {
10 try {
11 const response = await fetch(fredApiUrl);
12 const data = await response.json();
13

mortage_rate_drop_emailREADME.md1 match

@alm•Updated 9 months ago
1Checks Freddie Mac API for current interest rates, and notifies me if it drops to 4.1% or below so I can refinance.

MuxAITranscriptmain.tsx2 matches

@decepulis•Updated 9 months ago
13});
14const assemblyai = new AssemblyAI({
15 apiKey: Deno.env.get("ASSEMBLY_AI_KEY"),
16});
17const openai = new OpenAI({
18 apiKey: Deno.env.get("OPEN_API_KEY"),
19});
20

MuxAITranscriptREADME.md2 matches

@decepulis•Updated 9 months ago
13
14- Mux Access token details (`MUX_TOKEN_ID`, `MUX_TOKEN_SECRET`) This endpoint requires an existing Mux asset that's ready with an audio-only static rendition associated with it. You can run [this val](https://www.val.town/v/mux/createDubbingTestAsset) to create a new one for testing.
15- AssemblyAI API key (`ASSEMBLYAI_API_KEY`). Get it [from their dashboard here](https://www.assemblyai.com/app/account)
16- OpenAI API key (`OPENAI_API_KEY`). Get it [from their dashboard here](https://platform.openai.com/api-keys)
17
18Make a POST request to the Val's endpoint with the following body, replacing the values with your own asset ID and the list of speakers. Speakers are listed in order of appearance.

vapi-minutes-db1 file match

@henrywilliams•Updated 11 hours ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 13 hours ago
api
aquapi