HN user

peterjmag

1,529 karma

I'm a frontend/UI hacker. I moved from Colorado to Berlin in 2013, and now I work remotely for DigitalOcean: https://www.digitalocean.com/

https://twitter.com/peterjmag

https://stackoverflow.com/cv/peterjmag

http://peterjmags.com

hi@peterjmags.com

Posts7
Comments235
View on HN

It’s my first time playing any Civ game ever. I’m currently at the top of the scoreboard for reasons entirely unbeknownst to me. My advice for anyone else considering playing their own game: form an alliance with the server admin.

This post prompted me to fix a problem I’ve had for literal years. Forgive the tangent, but I’m so happy that I needed to share. I imagine I’m not the only one who’s run into this particular issue, so hopefully it’s helpful for others too.

If you’d prefer, feel free to skip over the story to the links at the bottom.

I use a single large(ish) monitor and multiple virtual desktops, or “spaces” as macOS calls them. I have Chrome windows on all of my desktops. When I quit Chrome with ⌘Q and then relaunch it, it collects all of my Chrome windows onto one desktop instead of restoring them to the desktops that they were on previously.

For something like 14 years(!), this has driven me up a wall.

Notably, it doesn’t happen when Chrome relaunches to update itself or when I reboot my machine. In those cases, the app happily restores all my windows to their respective desktops. It’s almost as if it’s taunting me: “oh sure, I can do what you want, I just choose not to sometimes.”

Every once in a while, I go down a rabbit hole, trying to find a solution. I always come up empty-handed. Usually I just find a small handful of other people complaining the same issue. It was never a particularly easy thing to google, and it didn’t help that that it wasn’t clear who was even at fault. Was it a Chrome thing? A macOS thing? Maybe some combination of both? Or even worse, maybe it was a “wontfix, works as intended” situation?

Over the years, I’ve learned to cope. I rarely quit Chrome anyway, aside from updates and reboots, so the itch wasn’t that strong. Or maybe the itch just became part of me. Who knows.

But today, reading this post about things that suck in macOS, I thought of my own thing that sucks in macOS. Like remembering an old friend. An old friend who drove you crazy but who, nonetheless, you cared about.

And today, for old times’ sake if nothing else, I once again googled some combination of the words “Chrome”, “restore”, “windows”, “multiple”, and “spaces”. And folks, this time, I found it.

There’s a setting called NSWindowRestoresWorkspaceAtLaunch. (How had I never found this before? It’s so simple!) You can change the setting for any app, not just Chrome.

https://superuser.com/a/1490087/77154

In case the Stack Exchange network finally succumbs to whims of private equity or otherwise gets lost to sands of time (it’s a fear I have), here’s a gist with the same instructions:

https://gist.github.com/f-steff/0163e0c1ed174e8ab7b33101ab47...

I can also put to rest my internal “feature vs bug” debate. Here’s Apple’s response to a bug report from the Chrome team (presumably from before they added the NSWindowRestoresWorkspaceAtLaunch setting):

This issue behaves as intended based on the following: Application restart does not preserve space assignment. We are now closing this bug report.

https://issues.chromium.org/issues/40531488#comment57

The original document being commented isn't available anymore. Luckily, the Internet Archive has a copy:

https://web.archive.org/web/20000517232106/http://webreferen...

Digging around a bit more, the original webreference.com (along with this article) existed until around April 2020. It's since been replaced by a generic landing page with a prompt to "subscribe to be the first to know when we relaunch". Shame that the article's URL doesn't work anymore after being maintained for 22 years. I imagine the domain was sold or something?

https://web.archive.org/web/20200330143723/http://webreferen...

Double clicking selects a word, and triple-clicking selects the whole line. If I double- or triple-click-and-hold, I can drag the mouse to expand the selection word-wise or line-wise, not just character-wise. This works with the paragraphs of text in the body of this blog post, too.

I had no idea that you could end with a drag to expand your selection by word or by line like that. That's really cool. (The author's using Linux, but it works on macOS too.)

Were your kids pronouncing island like "iz-land" or "eye-land"? Just asking because other people in the thread seem to be focusing on the "H" sound rather than the fact that "Island" is the German word for Iceland. Another fun layer of confusion for multilingual kids :)

Totally agreed that it's invasive. Same for the "typing" indicator, which also can't be disabled. If I'm writing something longer than a sentence or two, I usually just compose it somewhere else and then copy/paste it into WhatsApp, just to avoid feeling observed.

The fact that those two things can't be disabled actually makes me want to use WhatsApp less. I doubt I'm alone in that. Makes me wonder if Facebook's "engagement" stats account for those types of disincentives.

I disagree — those issues are totally for the company to solve. Or at least, the company should be prepared to meet employees halfway. If a North American company is going to insist that I work North American hours whilst living in Europe, I'm just not going to work there. And I'm sure I'm not the only one who feels that way.

I live in Europe and work for a very remote-friendly, NY-based company, and I work pretty normal European hours. I have 2-3 hours of overlap with the various members of my team, and that's all I need. (In fact, I'm more productive in the morning here because it's easier for me to focus when our group chat is mostly quiet.)

Of course, it's not as simple as saying that you can work from anywhere for anybody at any time, but I don't think it's fair to say that timezone issues are not for the company to solve.

I like function components too, but I've seen some interesting arguments against using them:

https://medium.freecodecamp.org/7-reasons-to-outlaw-reacts-f...

And I wish I had a reference for this, but I seem to remember reading that any future performance optimizations that could be applied to function components could probably also be applied to class components (at least ones that contain only a render() function and nothing else).

In any case, I'm hoping that React eventually gets to a point where developers don't have to make a choice between class and function components, and the compiler or the runtime makes that decision for us on a per-component basis.

EDIT: As an example, here's a Babel plugin that takes care of the conversion for you at compile time: https://github.com/remcohaszing/babel-plugin-transform-react.... Not sure what its heuristics are for determining what should and shouldn't be converted though, if any.

I think GitHub's great, and I'm mostly okay with having to rely on it heavily at my day job, but I dislike how code reviews + PRs are necessarily tied to branches.

What are the chances of GitHub introducing stacked diffs (or a similar abstraction) as an option? It'd be great to try out this workflow on a non-trivial project, but it seems like a hard sell organizationally when it involves migrating to and supporting a completely different tool like Phabricator or Gerrit.

Berliner Morgenpost published a cool little interactive thing last week where you draw where you think the wall used to be and it tells you how close you were:

https://interaktiv.morgenpost.de/berliner-mauer/

(German only, but the headline basically just means "do you know where where the wall divided Berlin?")

I've lived here for a few years, but I found it really challenging myself!

In B-Flat 9 years ago

This is one of my all-time favorite things on the internet. I was so inspired by it that I did a sort of half-formed "installation art" piece using it for a college class back in 2011. I projected the site onto a wall, hooked up some speakers, and prompted people to touch any of the videos, but I didn't explain anything else beforehand. When someone touched one of the videos, it would start, and when someone touched the same one, it would pause — just like a large touchscreen.

It's amazing what you can create yourself with this, but imagine what it's like when you have a large group "composing" it together, and then collectively deciding when to end it (or not!). Watching people go "ah ha" and then starting to communicate wordlessly to create their own piece, unique to their particular group, was so rewarding.

In hindsight, I wish I'd recorded it! (And if I were to do it again, I'd definitely want to get in touch with the creators and get their permission first.)

Theoretically, yes. In fact, Senate Bill 152, passed in 2005, already outlaws municipal broadband. From the article:

Colorado has a state law requiring municipalities to hold referendums before they can provide cable, telecom, or broadband service. Yesterday, voters in Eagle County and Boulder County authorized their local governments to build broadband networks, "bringing the total number of Colorado counties that have rejected the state law to 31—nearly half of the state's 64 counties," Motherboard wrote today.

As far as I know, there have been attempts to make it impossible for a community to opt-out, but nothing's been successful yet. In fact, most recently, it looks like the tide has been turning in favor of repealing the ban state-wide (which wouldn't be surprising considering the 31 counties that have already opted out). Here's a bit more info:

https://co-wa.org/2017/01/26/senate-bill-152-primer/

I guess what I was trying to say is that I wish the JS world had had its own gofmt/refmt from the get-go. But since it didn't, the community's still pretty undecided more than 20 years after the language came into being, and I don't see that changing significantly any time soon. I don't know, maybe it's "too late"?

Not that I think golang got it exactly right either, but because the style guide was essentially built into the language from the start, the change process is necessarily slower and more intentional, and I think that's a good thing.

even though StandardJS's decisions don't match the style predominant in the JS community

I find it particularly ironic that there's a reasonably popular fork called semistandard. [1]

In all seriousness though, I'd really love to see the JS community move towards tools like prettier[2] instead of continuously trying to establish "one eslint config to rule them all". I just want each repo I work with to configure my editor for me and reformat stuff automatically (a la gofmt) so I can forget about it. Even if some of the particular style decisions are ones that I personally don't agree with, it doesn't matter — the value of having those decisions abstracted away from me in the first place is significant enough that any minor quibbles fade away pretty quickly. Then I can focus on writing and reading code, not on arguing about whether we should enforce or disallow dangling commas in our lint config.

[1] https://github.com/Flet/semistandard

[2] https://github.com/prettier/prettier