HNHacker News
TopNewBestAskShowJobs

franey

127 karma · joined February 29, 2016

https://johnfraney.ca
submissionscomments
franey··on Anecdotally, programmers dislike "reduce"
That's an interesting idea. I might get hung up for cases where "previous" is a different type from "current", like if you're reducing a list of objects into a single object. You've got the current item of the array and the current state of the accumulator, so they're kind of both current. Or you've got the last state and current item, but "last" is ambiguous.

In general, I find that if something is hard to describe in plain language, it's hard to code. Reducers are a bit clunky to talk about, which could make them harder to reason about, too.

franey··on Anecdotally, programmers dislike "reduce"
At least in TypeScript, it's a bit clunky to type, and I usually forget the order of the reduce function's arguments (accumulator, current item). Maybe it's just me, but it's especially easy to forget the order when the position of the accumulator is the 1st argument to the callback but the 2nd argument of the reduce function:

    array.reduce(
      (accumulator, currentItem) => {...},
      initialValue,
    )
In .filter(), The current item is the 1st argument and the intermediate/accumulated value comes later: filter((currentItem, index, intermediateArray)) => ...)

I use .filter() more often, so that argument ordering where currentItem is right next to the array is more intuitive for me

franey··on Pebble Index 01 – External memory for your brain
It looks to me like the big benefit is being able to use just one hand for this. I'd be more likely to use the watch, too, but this would be great for people with one arm, for example.
franey··on It's time for modern CSS to kill the SPA
For anyone looking to use this, I recommend using this CSS before the closing body tag. It disables the fade effect for visitors who prefer reduced motion, and the old page fades out while the new one fades in. (I've got an optional rule that keeps my header in place while the rest of the content fades out/in)

  @media (prefers-reduced-motion: no-preference) {
    body > header {
      view-transition-name: header;
    }

    @view-transition {
      navigation: auto;
    }

    ::view-transition-old(root) {
      animation: fade-out 0.3s ease;
    }
    ::view-transition-new(root) {
      animation: fade-in 0.3s ease;
    }

    @keyframes fade-in {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    @keyframes fade-out {
      from { opacity: 1; }
      to { opacity: 0; }
    }
  }
franey··on How to help us build open source Pebble software
I had a Pebble Time Round, too, and it was great. For me the Pebble hit a sweet spot for a smart-enough watch that allowed me to keep my phone in my pocket. I could get notifications and reply to them right from the watch. I have a Withings SteelHR now, and it's great as a watch + activity tracker, but not being able to dictate replies to the notifications I get means I reach for my phone more now than I did with my Pebble
franey··on How to write user stories that get done
This post might have some hot takes and I'm no expert, but over the past decade I've found these rules of thumb to be helpful when reviewing and writing user stories.

If you have some other tips, I'd be happy to hear them!

franey··on What dif­fer­enti­ates front-end frame­works
It is something that distinguishes them, certainly. As someone who switched from using Vue to React at my day job, dev tooling & editor support have been the things that stand out the most to me. React works well with Vite, which has helped make it easier to use, and I've been migrating projects away from Webpack + Jest to Vite + Vitest, which saves a lot of dependency maintenance. I definitely miss Vue 3's VS Code extension when I work in React, though.
franey··on Ask HN: Could you share your personal blog here?
https://johnfraney.ca/blog/

Generally I'll write a post when I try to do something that's difficult to find an example of online. I don't get a _ton_ of traffic, but writing prose is a nice change from writing code.

franey··on EU-wide maximum limit of €10K for cash payments
We're getting pretty off topic, but it wasn't what they were protesting that was illegal, it was how they did it. For a US comparison, First Amendment rights don't include a right to occupy city streets for weeks, even if you're doing it to protest the government.
franey··on EU-wide maximum limit of €10K for cash payments
It wasn't, no. It was meant to clarify for other readers that people didn't have their bank accounts frozen for protesting COVID; they had their bank accounts frozen for financially supporting or participating in an illegal occupation of a city centre.

Your point stands that governments/courts decide what is illegal and that they have the power to freeze bank accounts when those accounts are used to fund illegal activities.

franey··on EU-wide maximum limit of €10K for cash payments
For people not familiar with Canadian politics, this summary missed some important nuance. Bank accounts were frozen for some people who donated money to support an illegal occupation of part of Canada's capital city, Ottawa. The occupation was a mix of people protesting COVID measures and others demanding that Justin Trudeau resign.

https://www.cbc.ca/news/politics/emergency-bank-measures-fin...

franey··on AVIF support enabled by default in Firefox 86
You bet. I've played around with AVIFS and it can autoplay and loop. I made gif2avif.com for fun, but I can't promise that it will work well.
franey··on DigitalOcean App Platform
That was a great MVP plan for that feature! Figuring out what not to build is a great way to save development time.
franey··on Thank You MDN
I'm over a decade into web development, and I still reference it every week. Last week I thought I should start a blog post about how, for me, it's the single best resource on the web. I sure hope it stays that way!
franey··on Overview of Python dependency management tools
This is a good point about complexity. I started with pip + virtualenv, and I'd recommend pip + venv to anyone learning Python. venv is in the standard library, so there's official documentation for it.

I picked up Pipenv when a point-point release of a dependency broke a production deployment. Pipenv's dependency locking meant that I wouldn't get surprised like that again.

Part of why this topic comes up so much is the desire to run with a language before learning to walk with it, perhaps. I'm a big fan of Poetry, but I like it because I know what it gives me compared to vanilla pip and a setup.py file.

Installing dependencies at the OS level will get you far as a beginner. And when the time comes that you need a virtual environment, you'll probably know.

franey··on Overview of Python dependency management tools
I think this is a good basic overview of the dependency management landscape. I have a few things to add.

One is that because Python has been around for so long, it's easy to find outdated or conflicting advice about how to manage Python packages.

I think it's important to stress that pyenv isn't strictly a dependency manager, too, and depending on your OS, isn't necessary. (Supported Python versions are in the AUR[0].)

A lot of pain from Python 2 -> 3 is that many operating systems were so slow to switch their default Python version to 3. Unless something has changed in the last month or so, Mac OS _still_ uses Python 2 as the default.

It's a shame to see Python take a beating for OS-level decisions.

[0] https://aur.archlinux.org/

franey··on Overview of Python dependency management tools
Poetry does a good job of managing/publishing a package without having to custom-code a setup.py. I have a blog post about it but I don't want to spam. Poetry works well for a package of average complexity, and it's configured entirely in pypyroject.toml. I don't have experience publishing something complicated with it, though.
franey··on Overview of Python dependency management tools
Pipenv has had a couple releases recently, but I've had an easier time with Poetry. Poetry is almost always[0] faster than Pipenv, and I find its commands more intuitive.

I've been meaning to take another look at Pipenv, but the huge pause without a release makes me nervous that it could happen again.

[0] https://johnfraney.ca/posts/2019/11/19/pipenv-poetry-benchma...

franey··on Ask HN: What is your blog and why should I read it?
https://johnfraney.ca

I'm not sure how awesome it is, but I like to write about a particular problem that I came across and solved recently or an experiment that I tried, like writing a Vue app using a Python-to-JavaScript transpiler. I mostly write about Python and Vue, sometimes veering into CSS, Markdown, and TypeScript. Instead of just giving the solution, I try to walk through the problem and give background and bad jokes along the way.

franey··on What the Heck Is Pyproject.toml?
I think of Poetry as the Yarn of Python packaging for two main reasons (apart from package locking, which is the biggest similarity): the commands are more intuitive and the lockfile starts with a different letter from the dependency file. I don't know how many times I open package-lock.json instead of package.json because I tab-complete from my shell. Same with Pipfile and Pipfile.lock for anyone using Pipenv.

I wrote this post[0] that compares Poetry and Pipenv if you're interested and talks about some of their differences. Poetry has both add and install commands, whereas Pipenv only has an install command, for instance.

[0] https://johnfraney.ca/posts/2019/03/06/pipenv-poetry-benchma...

franey··on You’re not writing code, you’re solving problems
I second this. Poetry is a great all-in-one tool for dependency and package management. I've written a few blog posts about it, and I remain happy with it. The Poetry team has done a great job making quality of life improvements to the tool, and it's actively maintained. It's worth checking out.
franey··on My Python Development Environment, 2020 Edition
I've used both and recommend Poetry. It's got a larger feature set (it can be used to manage packages _and_ publish packages), it's faster, and it's more actively developed (measured by releases). Pipenv's last release was 2018-11-26, and Poetry has been publishing pre-releases as recently as three days ago to prepare for v1.0.0.

I did a quick comparison here[0], and I'm planning to do an update with the latest version of Poetry.

[0] https://johnfraney.ca/posts/2019/03/06/pipenv-poetry-benchma...

franey··on Why I don’t love light rail transit
That could be getting at what confused me about the article. The author mentions the crosstown LRT favourably, and that will link up to the UP commuter/airport line I mentioned, adding another stop.

LRT linking to commuter rail lines, subway lines, and bus stops is something the author didn't really mention, but it certainly seems to be the strategy for that line in Toronto.

The author is against cutting funding for bus routes, which is reasonable. I guess I just don't see how that is also an argument against using LRT for arterial transportation into downtown cores. If the retort to that is "budgets", then we need increased funding for public transportation, not fewer trains.

franey··on Why I don’t love light rail transit
I got that impression, too. There wasn't much mention of bus/streetcar-plus-train transit strategy, which certainly happens in Toronto.
franey··on Why I don’t love light rail transit
One thing I'm surprised this article didn't mention is commute times. To get from Weston Station (northwest of downtown) to Union Station takes:

- 22-minute drive (or 1h in rushour)

- 1.25-hour bus ride

- 13-minute LRT ride

LRT (light rail transit) really is an excellent way to get into the downtown core from distances and in time frames that were previously only manageable by car.

franey··on Ebola Is Now a Disease We Can Treat
I've used this wrapper[0] for Firefox's reader mode[1], and it worked well:

[0] https://www.npmjs.com/package/readability-wrapper

[1] https://github.com/mozilla/readability

franey··on System76 Will Ship Linux Laptops With Coreboot-Based Open-Source Firmware
What distro? I have a T495s and I haven't had any issues with it running Arch.
franey··on The AMD 3rd Gen Ryzen Deep Dive Review: 3700X and 3900X Raising the Bar
I asked Lenovo support about this, and the rep said a customizable version would be available withing two months. I'm in Canada, but I imagine the US won't be later than here.
franey··on Singular “they” and the many reasons why it’s correct (2009)
'Everybody' is singular, and 'their' is (generally) plural. One way to resolve that conflict would be to rewrite the second clause to say "...as one ought to do when one falls into deep water in one's clothes". Using 'one' isn't very common in North America in my experience.
franey··on Create and Publish a Python Package with Poetry
I recently took Poetry for a spin when releasing Flake8 Markdown[1], and I thought it might be helpful to walk through the process of making a package using Poetry, from start to finish.

I found it more straightforward than using setup.py and twine, which I used for other packages.

How are you publishing to PyPI these days?

[1] https://github.com/johnfraney/flake8-markdown

Page 1 of 2Next →