• stevekrouse avatar
    fetchJSON
    @stevekrouse
    An interactive, runnable TypeScript val by stevekrouse
    Script
  • std avatar
    email
    @std
    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
    Script
  • stevekrouse avatar
    nominatimSearch
    @stevekrouse
    Geocode a free-form description via the Nominatim API The search API allows you to look up a location from a textual description or address. Nominatim supports structured and free-form search queries. Docs: https://nominatim.org/release-docs/latest/api/Search/
    Script
  • stevekrouse avatar
    today
    @stevekrouse
    Today's Date Returns today's date without timestamp. Usage @stevekrouse.today() // "10/07/2023"
    Script
  • stevekrouse avatar
    msDay
    @stevekrouse
    An interactive, runnable TypeScript val by stevekrouse
    Script
  • stevekrouse avatar
    weatherGovGrid
    @stevekrouse
    Lookup a weather.gov grid by lat, lon Documentation: https://www.weather.gov/documentation/services-web-api Forecasts are created at each NWS Weather Forecast Office (WFO) on their own grid definition, at a resolution of about 2.5km x 2.5km. The API endpoint for the 12h forecast periods at a specific grid location is formatted as: https://api.weather.gov/gridpoints/{office}/{gridX},{gridY}/forecast For example: https://api.weather.gov/gridpoints/TOP/31,80/forecast To obtain the grid forecast for a point location, use the /points endpoint to retrieve the current grid forecast endpoint by coordinates: https://api.weather.gov/points/{latitude},{longitude} For example: https://api.weather.gov/points/39.7456,-97.0892
    Script
1
Next
December 8, 2023