Avatar

shawnbasquiat

Previously an Amazon Software Engineer, Building Open-Source Communities for Tech Professionals Site: https://ShawnCharles.com CV: https://ShawnCharles.com/resume
Likes
39
std avatar
email
@std
Script
Email - Docs ↗ Send emails with std/email . You can only send emails to yourself if you're on Val Town Free. If you're on Val Town Pro , you can email anyone. Want to receive emails instead? Create an email handler val Basic usage import { email } from "https://esm.town/v/std/email"; await email({ subject: "New Ink & Switch Post!", text: "https://www.inkandswitch.com/embark/" }); subject The email subject line. It defaults to Message from @your_username on Val Town . to , cc , and bcc By default, the to field is set to the owner of the Val Town account that calls it. If you have Val Town Pro, you can send emails to anyone via the to , cc , and bcc fields. If you don't have Val Town Pro, you can only send emails to yourself, so leave those fields blank. from The from is limited to a few options: It defaults to notifications@val.town if you don't specify it. If you do specify it, it must be of the form: your_username.valname@valtown.email . replyTo replyTo accepts a string email or an object with strings for email and name (optional). This can be useful if you are sending emails to others with Val Town Pro. import { email } from "https://esm.town/v/std/email"; await email({ to: "someone_else@example.com", from: "your_username.valname@valtown.email", replyTo: "your_email@example.com", text: "these pretzels are making me thirsty", }); Attachments You can attach files to your emails by using the attachments field. Attachments need to be Base64 encoded, which is that the btoa method is doing in this example: import { email } from "https://esm.town/v/std/email"; export const stdEmailAttachmentExample = email({ attachments: [ { content: btoa("hello attachments!"), filename: "test.txt", type: "text", disposition: "attachment", }, ], }); Here's an example sending a PDF . 📝 Edit docs
stevekrouse avatar
easyAQI
@stevekrouse
Script
easyAQI Get the Air Quality Index (AQI) for a location via open data sources. It's "easy" because it strings together multiple lower-level APIs to give you a simple interface for AQI. Accepts a location in basically any string format (ie "downtown manhattan") Uses Nominatim to turn that into longitude and latitude Finds the closest sensor to you on OpenAQ Pulls the readings from OpenAQ Calculates the AQI via EPA's NowCAST algorithm Uses EPA's ranking to classify the severity of the score (ie "Unhealthy for Sensitive Groups") It uses blob storage to cache the openai location id for your location string to skip a couple steps for the next time. Example usage @stevekrouse.easyAQI({ location: "brooklyn navy yard" }) // Returns { "aqi": 23.6, "severity": "Good" } Forkable example: val.town/v/stevekrouse.easyAQIExample Also useful for getting alerts when the AQI is unhealthy near you: https://www.val.town/v/stevekrouse.aqi
stevekrouse avatar
discordWebhook
@stevekrouse
Script
Send a Discord message Send a message to a Discord channel from Val Town. It's useful for notifying your team or community when someone interesting happens, like a user signup, Stripe payment, mention on social media, etc. import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook"; await discordWebhook({ url: Deno.env.get("engDiscord"), content: "Hi from val town!", }); Example val: https://www.val.town/v/stevekrouse.discordWebhookEx Setup 1. Create a Discord Webhook Follow the instructions here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks It really only takes 2 minutes. 2. Copy webhook URL Paste it into your secrets as discordWebhook . 3. Send a message! import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook"; await discordWebhook({ url: Deno.env.get("engDiscord"), content: "Hi from val town!", }); Example val: https://www.val.town/v/stevekrouse.discordWebhookEx
stevekrouse avatar
dailyDadJoke
@stevekrouse
Cron
Daily Dad Joke How do you make a programmer laugh every morning? A dad joke cron job! Setup Fork this val Click Create fork 🤣🤣🤣🤣 API This val uses the icanhazdadjoke API . You can find more docs here , such as how to filter by type .
healeycodes avatar
isMyWebsiteDown
@healeycodes
Script
Uptime Checker & Status Page Installation Fork this val Edit the list of URLs to what you want to check For the status page, fork this val: @stevekrouse/status
stevekrouse avatar
aqi
@stevekrouse
Cron
AQI Alerts Get email alerts when AQI is unhealthy near you. Set up Click Fork Change location (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via nominatim's geocoder API . Click Run Background This val uses nominatim's geocoder to get your lat, lon, and air quality data from OpenAQ. It uses EPA's NowCast AQI Index calculation and severity levels. Learn more: https://www.val.town/v/stevekrouse.easyAQI
stevekrouse avatar
pollRSSFeeds
@stevekrouse
Cron
Poll RSS feeds This val periodically polls specified RSS feeds and send the author an email with new items. It checks each feed defined in rssFeeds for new content since the last run and sends an email with the details of the new items. Usage Fork @stevekrouse/rssFeeds and update it with your desired RSS feeds; Fork this val and replace the https://esm.town/v/stevekrouse/rssFeeds import with your newly forked val; Enjoy RSS updates on your email!
Next