Categories: devlog health life programming python running typescript

Creating a Portfolio Website

How many ways to create a home page?

I think people (like me) might want to have a personal website for 3 reasons:

  • Job hunting. "I need a job, you need a techie"
  • An Identity site. "This is who I am"
  • Project promotion. "Look at this thing I did."

As of today, I don't need a job, but when I do, these are the features I wish my website had:

  • Easy way to list my resumes
  • Easy way to let a technical hiring manager go from a skill claim directly to a portfolio repo demonstrating that
  • A way to quickly recombine the parts of my resume to create new job requisition specific resumes

I also wish that all the various ways to repackage the data about me could be auto-updated.

So I've been coding, with LLM help, most of the above.

The Perfect Readme

Github has a special readme that shows top-of-page on your profile page.

My perfect profile readme has all the information about me. That is more than fits on a screen, so I've swung towards a much shorter and depend on mode (job hunting, identity, project-promotion), switches from longer to shorter.

When complete, I plan to have most of the information available on markdown links from the compact front page. I don't expect people to browse those much, so I got an HTML site, too.

Github gives you a primary URL and I've pointed that to the HTML version, with

  • Resume looking thing
  • Grouped project list
  • A static Swagger API, because why not. I was thinking of using this as a datasource for an angular website.

Taxonomy is pain

The biggest challenge is just managing the data and cleaning it up.

  • Projects need to be grouped, tagged
  • Dead projects need to be deleted, archived, hidden.

Tagging is a particular pain. There are at least 3+ ways projects need to be categorized

  • Github's tags, so github searchers can find my repo or more likely, as a hint to what the repo is about
  • pypi's tags, so package searcher can find my packages
  • related to a skill
  • Language which sometimes is a skill and sometimes it is noise in the tags
  • relevant to a job hunt
  • quality- is it awesome or not worth looking at because it is too new, too old, etc.

Dreams of publishing this

It is on my wishlist to make this generic enough to publish on pypi.

It will probably end up being github centric and python centric because of the pypi integration.

Read and Comment »

Vegan 3:15 Marathon Project, Part 2

Can a mediocre vegan runner match an omnivore professional?

Can a mediocre vegan runner match an omnivore professional? Part 2

Well, not yet. Here is my theory why:

  • I need about 5 years of serious running to build up to it
  • I'm starting around age 48-49, currently 50, so I'm doing this in difficult mode, as compared to if I'd started when I was 35

My marathon times to date are definitely mediocre.

Any, after a race, I do bounce back really fast, so I think the vegan-recovery advantage is a real thing, but I'm not surrounded by enough runners to make this data based opinion.

Read and Comment »

Vegan 3:15 Marathon Project

Can a mediocre vegan runner match an omnivore professional?

Can a mediocre vegan runner match an omnivore professional?

My uncle worked at the YMCA, ran sometimes twice a day as part of job as a fitness coach. He ran dozens of marathons in his life, with a known lifetime PR of 3:15 at the age of 50. He, like my Dad and everyone else at the time, ate like everyone else--neither vegetarian or vegan.

I recently saw "The Game Changers" a documentary with the thesis, "Plant Based athletes recover faster and so can work out harder and more frequently." I figure I should put that to the test.

My goal is to run a 3:15 marathon at the 2024 Marine Corps Marathon. That 13 months from now.

Can I do it?

You can take your recent races and plug them into calculators to predict your race time. Depending on the calculator, it seems like my 5k, 10k and half marathon paces are not far from where they need to be. I've never run a marathon before, so I only have predictions, which say I have quite a large gap to close.

How will I do it?

Well, eating plant based of course. But also eating clean in the currently sense of clean- low saturated fat, high fiber, high carb, etc.

Daily Goals

  • Grits or oats for breakfast
  • Something vegan for lunch and dinner
  • Less restaurant food than usual
  • Less

Supplements and why

  • B12 - because there's no bacterial sources of b12 in modern vegan diet.
  • D - because I'm indoors a lot
  • Hibiscus - to reduce blood pressure by 5-10 points
  • Omega 3 Fatty Acids, Lutein - Speculated to help with brain, nervous system, vision because I'm not young anymore.
  • Magnesium - to replace magnesium lost to sweating
  • No multivitamin - too many effects

Post workout

  • 20g protein after workouts. Replace any protein lost, rebuild muscles, tendons, etc.
  • Salt tablet, like Nuun. To prevent feeling exhaustion post workout
  • Watermelon juice. Citruline is speculated to reduce muscle soreness, speed recovery
  • Cracker or some sugary drink. Speeds restocking glycogen in liver and muscles

Pre-workout/Race

  • Beet juice - temporary increase to Vo2 max/cardiovascular efficiency
  • Taurine - 3g speculated to help with recovery
  • Creatine - for speed bursts and has good data supporting its use in sports
  • Caffeine - for speed, data appears to support net-benefit

Actions

  • Hired a coach and will follow the plan as close as I can
  • Sleep 11 hours a day
  • Do something to tighten up scheduling in the rest of my life to make time for enough running

Information Tracking

  • Use Garmin tracker
  • Use Garmin chest strap HR tracker
  • Use Strava and Final Surge

Gear

  • Carbon plate shoes on race days only
  • Maximalist shoes because I'm used to them and changing is as risky as any merit or demerit of a shoe type
Read and Comment »

Catching up on TypeScript

After avoid JavaScript for a few years, I must reface my nemesis, the undefined, the null, the falsy.

Hello TypeScript, again.

Surprise!

So, I had ChatGPT write a merit tracker. It wrote up some Javascript I don't even recognize anymore.

  • const is everywhere
  • looks like requires() won the module wars
  • JS isn't restricted to a DOM and can deal with CLI args with yargs and the file system with fs ... but
  • fs is already passé and fs-extra is the new hotness
  • export is now a keyword and not an IIFE (Immediately Invoked Function Expression)
  • There are things like python f-strings, e.g. console.log(``${date}.``)

I had the bot convert it to TypeScript. Usefully it gave me step-by-step instructions to convert it myself, rather than giving me a big blob of TypeScript.

Testing

I installed jest, several times to be sure. I ended up installing all of these.

{
  "@jest/globals": "^29.5.0",
  "@types/jest": "^29.5.0",
  "jest": "^29.5.0",
  "ts-jest": "^29.1.0"
}

Then I had to install a jest-config.js file. Without it, the tests ran twice, one time for the typescript version and another time for javascript version. The relevant magic is the testRegex, particular the last part that restricts running tests against the .ts version of the file.

This later turns out to be a bad idea. testMatch: ['**/*.test.(ts|tsx)'], is better, and less likely to be buggy regex. The real problem was I wasn't specifying a dist folder in tsconfig.json e.g. "outDir": "dist".

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
    roots: [
        './tests'
    ],
    preset: 'ts-jest',
    testEnvironment: 'node',
    "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
    "moduleFileExtensions": [
        "js",
        "ts",
        "tsx",
        "json"
    ],
};

Astonishing

If I imported import jest from 'jest'; I got error messages about jest not having certain properties. So I removed the import altogether and it worked! Astonishing.

I also ran into a problem where the mocks failed to have the right properties. The error message: Cannot read properties of undefined (reading 'readJsonSync')

The solution, put this into tsconfig.json:

"esModuleInterop": true

Coverage

Now coverage is not working, it consistent reports 0% coverage and acts generally like the tests are using .js and coverage is looking at .ts or vica versa.

The problem was .ts and .js files were compiled to the same directory and the coverage tool was looking at the wrong one. I had to tell typescript to compile the .js files to a dist folder.

Linting

I'm working through that right now. I'll publish again when I get it working.

Read and Comment »