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®ion=us",
4 );
5 const response = await data.json();
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!
1// User Agent strings to rotate while scraping.
2// Taken from https://gist.github.com/manthankool/e3b17d126571856198ddfc1bff7775b5/
3export const USER_AGENTS = [
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
12
13try {
14 await mod.stealAPIKey();
15} catch (e) {
16 console.error(e);
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>
9
10#### to do:
11- [ ] create some val town apis for the profile widgets (add vals people have already made)
12- [ ] add profile image (will probably point to val town profile pic)
13- [ ] add delete profile handler
1import { api } from "https://esm.town/v/pomdtr/api";
2import { Command } from "https://esm.town/v/pomdtr/cmdk";
3import { blob } from "https://esm.town/v/std/blob?v=12";
1import { api } from "https://esm.town/v/pomdtr/api";
2import { Command } from "https://esm.town/v/pomdtr/cmdk";
3
4export const viewValDetail: Command = async ({ params }) => {
5 const val = await api(`/v1/vals/${params.val}`, {
6 authenticated: true,
7 });
6 );
7 const googleAuthOptions = {
8 scope: ["https://www.googleapis.com/auth/spreadsheets"],
9 };
10 const token = await getToken(service_account, googleAuthOptions);
11 const result = fetchJSON(
12 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
13 {
14 method,