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 />
21To run it:
22
231. Get your free Steel API key at https://app.steel.dev/settings/api-keys
242. Add it to your [Val Town Environment Variables](https://www.val.town/settings/environment-variables) as `STEEL_API_KEY`
253. Click `Fork` on this val
264. Click `Run` on this val
72
73- [Steel Documentation](https://docs.steel.dev)
74- [API Reference](https://docs.steel.dev/api-reference)
75- [Discord Community](https://discord.gg/gPpvhNvc5R)
6});
7
8const STEEL_API_KEY = process.env.STEEL_API_KEY;
9// Initialize Steel client with the API key from environment variables
10const client = new Steel({
11 steelAPIKey: STEEL_API_KEY,
12});
13
36 // Connect Puppeteer to the Steel session
37 browser = await puppeteer.connect({
38 browserWSEndpoint: `wss://connect.steel.dev?apiKey=${STEEL_API_KEY}&sessionId=${session.id}`,
39 });
40
1import { api } from "https://esm.town/v/pomdtr/api";
2import { extractMetadata } from "https://esm.town/v/pomdtr/extractMetadata";
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
5
6export async function ideaList(author: string, name: string) {
7 const { code, readme } = await api(`/v1/alias/${author}/${name}`);
8 const title = extractMetadata("title", code);
9
3## Fetch Paginated Data
4
5This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
6
7Usage:
9```ts
10const id = <vt user id>
11await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
12 headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
13});
32
33 const response: telegramResponse = await fetchJSON(
34 `https://api.telegram.org/bot${botToken}/sendMessage`,
35 {
36 method: "POST",
1import { Resend } from "resend";
2
3const resend = new Resend(Deno.env.get("RESEND_API_KEY"));
4
5// resend.emails.send({
131const fetchForecast = async () => {
132 const response = await fetch(
133 `https://api.openweathermap.org/data/2.5/forecast?lat=${latitude}&lon=${longitude}&units=metric&appid=${openWeatherMapAppId}`,
134 );
135 const data = await response.json();
155const sendTextWithTelegram = async (text: string) => {
156 const telegramSendUrl =
157 `https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage?chat_id=${TELEGRAM_CHAT_ID}&parse_mode=HTML&disable_notification=true&text=${text}`;
158 await fetch(telegramSendUrl);
159};
1const API_KEY = Deno.env.get("WUNDERGROUND_API_KEY");
2const OPENWEATHERMAP_API_KEY = Deno.env.get("OPENWEATHERMAP_APP_ID");
3const LATITUDE = Deno.env.get("LATITUDE");
4const LONGITUDE = Deno.env.get("LONGITUDE");
7const WUNDERGROUND_STATION_ID = Deno.env.get("WUNDERGROUND_STATION_ID");
8
9const fetchLatestDataFromWunderground = async (stationId = WUNDERGROUND_STATION_ID, apiKey = API_KEY) => {
10 const baseUrl = "https://api.weather.com/v2/pws/observations/current?";
11 const url = `${baseUrl}stationId=${stationId}&format=json&units=m&numericPrecision=decimal&apiKey=${apiKey}`;
12 try {
13 const response = await fetch(url);
51const fetchDataFromOpenWeatherMap = async () => {
52 const response = await fetch(
53 `https://api.openweathermap.org/data/2.5/weather?lat=${LATITUDE}&lon=${LONGITUDE}&units=metric&appid=${OPENWEATHERMAP_API_KEY}`,
54 );
55 const weatherForecastData = await response.json();
70const sendTextWithTelegram = async (text: string) => {
71 const telegramSendUrl =
72 `https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage?chat_id=${CHAT_ID}&parse_mode=HTML&text=${text}`;
73 await fetch(telegramSendUrl);
74};
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`