githubEventsmain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23// GitHub events
4export let githubEvents = fetchJSON(
5"https://api.github.com/users/stevekrouse/events"
6);
fetchWeatherPredictionmain.tsx8 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export const fetchWeatherPrediction = async (req: Request) => {
4interface Forecast {
5startTime: string;
14};
15}
16async function fetchForecast(
17latitude: number,
18longitude: number,
19): Promise<Forecast[]> {
20try {
21// Fetch the points data to get the forecast endpoint
22const pointsUrl: string =
23`https://api.weather.gov/points/${latitude},${longitude}`;
24console.log(pointsUrl);
25const pointsResponse = await fetch(pointsUrl, {
26headers: { "Accept": "application/geo+json" },
27});
29const pointsData = await pointsResponse.json();
30const forecastUrl: string = pointsData.properties.forecast;
31// Fetch the actual forecast
32const forecastResponse = await fetch(forecastUrl, {
33headers: { "Accept": "application/geo+json" },
34});
54// don't really need names either
55// would be nice to convert name to lat/lng
56const forecast = await fetchForecast(lat, lng);
57console.log(`Forecast for ${placeName} @ ${lat},${lng}`);
58forecast.forEach((period) => {
getChatgptmain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
32122const getCompelitoins = async (data) => {
23const response = await fetch("https://api.openai.com/v1/completions", {
24method: "POST",
25headers: {
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
23export const rand = () =>
4fetchText("http://numbersapi.com/random/math");
fetchCongressTradeReportsmain.tsx4 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23/**
5Receive daily emails of reported congress trades by scheduling a call to
67@claytn.fetchCongressTradeReports((reports) => console.email(reports))
8*/
91011export async function fetchCongressTradeReports(callback) {
12const res = await fetchJSON(
13"https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14);
1import { fetch } from "https://esm.town/v/std/fetch";
23export const csvToJson = async (url: string) => {
14url =
15"https://www.ncbi.nlm.nih.gov/core/assets/pmc/files/removed_phe_articles_oa_subset.csv";
16const response = await fetch(url);
17const stream = response.body?.pipeThrough(textDecoder)
18.pipeThrough(csvParser).pipeThrough(jsonStringifier).pipeThrough(
scheduleExamplemain.tsx2 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export const scheduleExample = () => fetch("example.com");
alphaVantageSymbolQuerymain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/sean/fetchJSON";
2import { toQueryString } from "https://esm.town/v/sean/toQueryString";
32728try {
29const json = await fetchJSON(
30`https://${API_HOST}/query?${queryString}`,
31{
boredActivitiesmain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON(
5"https://www.boredapi.com/api/activity",
6);
nowCastPMAQImain.tsx2 matches
1import { nowcastPMAqi } from "https://esm.town/v/stevekrouse/nowcastPMAqi?v=6";
2import { msHour } from "https://esm.town/v/stevekrouse/msHour?v=1";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
45export async function nowCastPMAQI({ location_id }) {
6const { results } = await fetchJSON(
7"https://api.openaq.org/v2/measurements?" +
8new URLSearchParams({