Skip to content

About

Personal website and portfolio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

hedgertronic.com

A portfolio website showcasing my career highlights across baseball, research, writing, and media. Built with vanilla HTML/CSS/JS and served as static assets on Cloudflare Workers.

The home page features five subsections:

  • On the Field: Highlights from my baseball career, including stats, videos, and training content.
  • In the Lab: Research projects, presentations, and code, showcasing my technical contributions.
  • On the Page: My articles and analysis in both long-form and short-form mediums.
  • In the Media: Podcasts, interviews, and features.
  • Off the Clock: Personal hobbies and interests.

Additionally, the website includes a resume page along with a downloadable PDF version that is automatically generated to ensure information consistency.

Designed to be lightweight and responsive on the front-end, though admittedly a bit over-engineered on the back-end with JS builds and various testing mechanisms.

Structure

/assets      Fonts, images, documents
/css         Stylesheets (base, components, sections, layout are concatenated into styles.css)
/data        JSON content to define each website section
/src         JavaScript modules (bundled with esbuild)
/resume      Resume page
/evolution   Pitching evolution page
/tests       Unit (Vitest, pytest) and E2E (Playwright) tests
/tools       Python scripts for data fetching and asset generation; tools/prerender.mjs (Node) for the build
/.github     Deploy and daily data workflows
wrangler.jsonc  Cloudflare Workers static-assets config

Edit css/ and src/. styles.css, the script.js bundles, assets/documents/resume.pdf, and assets/images/og/og-image.png are build output: gitignored and regenerated by the deploy workflow.

index.html is hand-edited and ships with an empty <main>; locally, src/main.js fetches data/ and renders the sections. At deploy, tools/prerender.mjs runs those same render functions under jsdom and writes the header, hero links, sections and footer into _site/index.html, so the page is complete without JS. The client then only attaches behavior, re-rendering a section from its data when its "New" badges, preview thumbnails or number formatting would differ for the visitor (src/hydrate.js). To preview a prerendered page, assemble a site directory as the deploy does and run node tools/prerender.mjs <dir>.

Development

Build

npm ci
npm run build              # Bundle JS and concatenate CSS
npm run dev                # Rebuild JS on change (CSS needs `npm run build:css`)
python3 -m http.server     # Serve the site locally

Test

npm test           # JS unit tests (Vitest)
npm run test:e2e   # E2E browser tests (Playwright; serves on :8765)
uv run pytest      # Python unit tests

Deploy

Every push to main runs the tests, builds the JS/CSS, resume PDF, career stats and Open Graph image, assembles _site/, prerenders its homepage, and runs wrangler deploy (.github/workflows/deploy.yml). It needs the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets. The daily data workflow triggers a deploy after it commits.

Features

  • Responsive design: Full-screen hero page with five subsections. Hero section adapts to screen size and orientation for consistent experience across devices.
  • JSON content approach: Manages website content through JSON files, allowing for easy updates and version control.
  • Theme switcher: Six color schemes based on a "team colors" concept (data/themes.json): Driveline, Hopkins, Marlins (default), Mets, Phillies, and Rangers. Mets and Phillies also swap the headshot.
  • Automated workflows: Resume webpage and PDF automatically generate from JSON. Open Graph image generates from hero section content and theme. Career stats are merged from Baseball Reference and MLB Stats API (MiLB) data.

Automated Data Pipeline

A daily GitHub Actions workflow (.github/workflows/update-data.yml, cron 17 9 * * *) fetches fresh data and commits changes to main, then triggers the deploy workflow to publish immediately.

Automated sources (tools/fetch/):

  • MiLB (fetch_milb.py): Pulls per-team pitching stats from the MLB Stats API across all affiliated levels (AAA–Rk). Writes assets/documents/milb_api_stats.csv; tools/process_stats.py merges this with Baseball Reference data (college/summer/independent rows stay in bbref; milb rows replace bbref for covered seasons to avoid double-counting).
  • Twitter/X (fetch_tweets.py): Updates retweet, like, and bookmark counts in data/writing-shortform.json via the fxtwitter unofficial API.
  • GitHub (fetch_github.py): Syncs stars, forks, language, and description for repos in data/lab-projects.json via the GitHub REST API.
  • Substack (fetch_substack.py): Appends new posts from the RSS feed to data/writing-longform.json. New entries are appended; existing entries are never removed or reordered.
  • Goodreads (fetch_goodreads.py): Updates the currently-reading book in data/personal.json via the shelf RSS feed. Requires GOODREADS_USER_ID secret or a goodreadsUserId key in data/site.json.
  • Chess.com / USCF (fetch_chess.py): Refreshes rapid and regular ratings in data/personal.json.
  • Spotify (fetch_spotify.py): Updates the most-listened-to album. When Spotify's refresh token expires (about every 6 months) the workflow opens an issue; run uv run python tools/spotify_auth.py locally and update the SPOTIFY_REFRESH_TOKEN secret.

Interactive helper (tools/add_training_post.py): Assists with adding Instagram training posts — extracts the shortcode, compresses and copies the cover image, and prints a ready-to-paste JSON entry for data/field-training.json.

Build and one-off tools (tools/): generate_resume_pdf.py, process_stats.py, and generate_og_image.py run in the deploy workflow; generate_favicon.py and optimize_headshots.py regenerate favicons and headshot sizes by hand; optimize_thumbnails.py writes WebP copies of card thumbnails and posters at twice their display size and points data/*.json at them (rerun after adding an item with a remote or oversized image); subset_fonts.py subsets assets/fonts/ to the characters and weights the site uses.

Not yet automated (future work):

  • Instagram API: Automated cover image fetching — Instagram's API requires app review and does not expose public post media to third parties.

About

Personal website and portfolio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages