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=1475&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 17515 results for "api"(8725ms)

testingmain.tsx3 matches

@samhashemi•Updated 1 year ago
5// export let twitterJSON = ({ url, bearerToken }) =>
6// fetchJSON(
7// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
8// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
9// );
11// export function handler(request: Request) {
12// let elements = fetchJSON(
13// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
14// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
15// );
20export default async function(req: Request): Promise<Response> {
21 return fetch(
22 "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
23 // headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` }
24 );

btcPriceAlertmain.tsx2 matches

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

serve_routermain.tsx5 matches

@yieldray•Updated 1 year ago
16});
17
18app.route("/api")
19 // for /api
20 .get("", () => new Response("api"))
21 // for /api/one
22 .get("/one", () => new Response("one"))
23 // for /api/two
24 .get("/two", () => new Response("two"));
25

mockingSpongebobmain.tsx1 match

@carl•Updated 1 year ago
1/**
2 * Function that randomly capitalizes or lowercases each character in a string.
3 * Inspired by the mocking Spongebob meme: https://knowyourmeme.com/memes/mocking-spongebob
4 *

redSpoonbillmain.tsx1 match

@Joelsrubin•Updated 1 year ago
1export async function getTopTenBattingAverage() {
2 const data = await fetch(
3 "http://sports.core.api.espn.com/v2/sports/baseball/leagues/mlb/seasons/2024/types/2/leaders?lang=en&region=us",
4 );
5 const response = await data.json();

sendNotificationREADME.md1 match

@gwoods22•Updated 1 year ago
1# Push Notification Sender
2
3This val can be used in other vals to send notifications to a segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
4
5This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!

userAgentsmain.tsx1 match

@alexbowe•Updated 1 year ago
1// User Agent strings to rotate while scraping.
2// Taken from https://gist.github.com/manthankool/e3b17d126571856198ddfc1bff7775b5/
3export const USER_AGENTS = [

sqliteWasmmain.tsx1 match

@postpostscript•Updated 1 year ago
1import { DB } from "https://deno.land/x/sqlite/mod.ts";
2import { type InStatement, sqlite as sqliteAPI } from "https://esm.town/v/std/sqlite";
3import { type ResultSet } from "npm:@libsql/client";
4

workerifyExamplemain.tsx1 match

@postpostscript•Updated 1 year ago
12
13try {
14 await mod.stealAPIKey();
15} catch (e) {
16 console.error(e);

servermain.tsx1 match

@andreterron•Updated 1 year ago
15 <meta name="viewport" content="width=device-width, initial-scale=1" />
16 <style>
17 @import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap");
18 </style>
19 <style type="text/css" src="https://esm.sh/tldraw/tldraw.css"></style>

RandomQuoteAPI

@Freelzy•Updated 17 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 23 hours ago
Kapil01
apiv1