Avatar

dthyresson

I'm a GP at Preston-Werner Ventures where I invest in early stage startups. I enjoy ☕️ and collecting 🖍 street art, 🧷 punk/new wave/rock poster art and ephemera (Madchester, The Haçienda, and Factory Records), vintage 🥁 🤖 drum machines & 🎹 synths.
Joined February 20, 2024
Public vals
25
dthyresson avatar
graphQLYogaDeferAndStream
@dthyresson
HTTP
Forked from dthyresson/graphQLYoga
dthyresson avatar
graphQLYoga
@dthyresson
HTTP
GraphQL Yoga Server GraphQL Yoga from The Guild is a batteries-included cross-platform GraphQL over HTTP spec-compliant GraphQL server powered by Envelop and GraphQL Tools focused on easy setup, performance and great developer experience. Usage To access GraphiQL - the GraphQL Playground - visit the / route. That's what you see in the preview pane below. Configuration and Documentation See the GraphQL Yoga documentation for configuration and all the bells and whistles. Endpoint For this example, we'll set to / to make it easier to demo. However, by default, the GraphQL route is configured to be on /graphql which is more common. const yoga = createYoga({ schema, }) You can set a custom endpoint: const yoga = createYoga({ schema, graphqlEndpoint: "/my-gql", }) Landing Page A landing page is shown be default whenever a 404 is hit. You can disable it via the landingPage option. const yoga = createYoga({ schema, landingPage: false })
dthyresson avatar
processTrackBlobsJob
@dthyresson
Cron
processTracksBlobsJob Periodically fetch all Spotify tracks from Blob storage and update the tracks database with a subset of display information. Keys take the format: spotify_track_id:4tVhBXOhSlqYCL2IjyoUNu .
dthyresson avatar
resetFavoriteSongSearches
@dthyresson
Cron
Reset Favorite Song Searches Cron to clear and reset favoritre Spotify song searches periodically.
dthyresson avatar
playMeASong
@dthyresson
HTTP (deprecated)
Play me a song Search and if we find it, it'll open the song in Spotify! Feeling Lucky? Play a random song . Like a band? Play one of their tracks.
dthyresson avatar
getSpotifyAccessToken
@dthyresson
Script
getSpotifyAccess Token Request an access token for use with the Spotify Web API. Requires environment variables from your Spotify Developers account. SPOTIFY_CLIENT_ID SPOTIFY_CLIENT_SECRET Uses Blob storage to cache the spotify_accessToken based on when the expires_in value in the Spotify Access Token response. Example import { getSpotifyAccessToken } from "https://esm.town/v/dthyresson/getSpotifyAccessToken"; const accessToken = await getSpotifyAccessToken(); console.debug(accessToken)
dthyresson avatar
getSpotifyTrackUrl
@dthyresson
Script
getSpotifyTrackUrl Get a Spotify Track Url using the Spotify Web API given an artist and a song title. Track info is cached by the query and also the spotify track id, so your popular queries won't have to fetch from Spotify over and over. Examples import { getSpotifyTrackUrl } from "https://esm.town/v/dthyresson/getSpotifyTrackUrl"; const reni = await getSpotifyTrackUrl("Stone Roses", "Fools Gold"); const ian = await getSpotifyTrackUrl("Joy Division", "Love Will Tear Us Apart"); const kim = await getSpotifyTrackUrl("Pixies", "Velouria"); console.log(reni) console.log(ian) console.log(kim) Info Uses getSpotifyAccessToken which requires you to set environment variables from your Spotify Developers account. SPOTIFY_CLIENT_ID SPOTIFY_CLIENT_SECRET Your access token is cached by getSpotifyAccessToken to avoid fetching over and over.
dthyresson avatar
airportCodeMapRedirector
@dthyresson
HTTP (deprecated)
IATA Airport Code Map Redirector I needed way redirect to a map for a given aiport given an IATA airport code . This way is it's a simple proxy redirect and I can change if I want to use Google Maps or another service (or change zoom levels, etc) without having to update the link. Usage: Boston Logan: https://iata.thyresson.io?q=bos
dthyresson avatar
whatsThatInHotDogs
@dthyresson
HTTP (deprecated)
What's that in Hot Dogs? Inspired by the 2014 Boston Baseball Hackday submission, this val shows how many hot dogs a baseball player can buy in a year based on his annual salary and the average price of a hot dog sold at their home team's stadium. Back then, the team spent most of the hackday time collecting data, building s javascript app from scratch and then deployed to Heroku. It took some time. It had much nicer design, artwork, styling, etc to be sure. I wanted to see how quickly a similar app could be created and made available on Val.town 10 years later. I asked Chat GPT to build the app: You are a javascript web developer and a baseball fan. Build a web app using Hono called "What's that in hot dogs?". The app should let you select a baseball player. Based on 1) the player annual salary calculate the number of hot dogs they could buy based on the average price of a hot dog sold at their stadium. For example, Mike Trout played for the Los Angeles Angels and makes $35M per year. The Los Angeles Angels play at Angel Stadium a hot dog costs $8. That means he can buy 35,000,000/8 = 4.375M hot dogs. The app lets you pick a player and then will display an emoji icon of a hot dog. One emoji hot dog is worth 100,000 hot dogs. So picking Mike Trout will show 43.75 (or 44) hot dog icons. It worked! But, it only had one player's worth of data. The app needs more player salary and hot dog price data. Find the top players in each MLB team, their salary, and the price of a hot dog at their home stadium. I then asked for a small improvement: Improve the app by also showing the team the play plays for, the stadium, salary and price of the hot dog. Include it in a nice table below the hot dog emoji list. Within 10 minutes, I had a working "What's that in Hot Dogs?". I then re-worked the headings and added a legend and it matched what I remember seeing back in 2014 ... but built and deployed in minutes versus hours. Note: Much of the 2014 team's time was spent collecting data manually by looking up players' salaries and finding the cost of a hot dog at stadiums. In this example, I've not validated that ChaptGPT correctly identified these figures.
Next