HNHacker News
TopNewBestAskShowJobs

throwitaway1123

469 karma · joined November 28, 2023

Created this account 11/23. Might throw it away at some point.
submissionscomments
throwitaway1123··on Japan declares victory in effort to end government use of floppy disks
Nothing wrong with a good meme. Everything used to be skeumorphic and used pre-tech metaphors — the OS desktop being a metaphor for the literal top of a desk complete with folder icons that look like paper folders. The World Wide Web was seen as a jungle to be navigated by browsers with names like "Netscape Navigator" and "Safari". Now GUIs are imitating early technology and kids have no idea what's being imitated.
throwitaway1123··on Python with Braces
Using braces in an arrow function that returns an object literal actually is ambiguous in JS, which is why you have to wrap it in parentheses, e.g.:

  const foo = () => ({foo: 'bar'})
If you omit the parentheses it gets interpreted as a block with a label and a string literal:

  const baz = () => {baz: 'bar'}
https://astexplorer.net/#/gist/9a86e0b61fda312dce2ea9d10d37f...
throwitaway1123··on Japan declares victory in effort to end government use of floppy disks
Somewhat tangential, but the floppy disc icon has become the universal indicator for "save", and yet there's a whole generation of computer users who have never used them. I have to remind myself when designing GUIs that icons can be ambiguous.
throwitaway1123··on Writing HTML by hand is easier than debugging your static site generator
It's not hard but why even bother with it at all just to serve static files? If I have Cloudflare in front of the VPS, then I might as well just use Cloudflare Pages where I can git push to deploy, and avoid paying for and administering a VPS.
throwitaway1123··on It's not just you, Next.js is getting harder to use
Frontend devs were largely bullied into imitating traditional MPAs by people posting memes about SPAs and loading spinners. A huge percentage of pages could simply be pre-rendered (e.g. static landing pages and documentation sites), or they're behind a login wall in which case SEO no longer really matters. Deploying an SPA used to mean uploading a few scripts and html documents to an S3 bucket, and with CDN caching it was fast enough for many organizations. Instagram is still a mostly 100% client side SPA.
throwitaway1123··on The many faces of undefined in JavaScript
The problem for me is that you can't ever irrevocably remove a feature from the language, which means you'll end up having to read and interact with code written in the original version if you spend enough time in the language ecosystem. I've seen developers that continue to litter their codebases with `var` in 2024 despite `const` and `let` replacing almost every valid use case for `var`.

Server side developers yearn for their favorite language in the browser, but are used to living in a world where language deprecations mean "this feature will disappear from all modern version of the language eventually" not "you can opt-out of this feature by placing a string somewhere in your code". To me that's a hollow definition of 'update'. Golang for example completely changed the semantics of for loops this year [1]. Moving forward, if you use a modern version of Go, you will accept the way for loops work now — there's no magical 'use old for loops' string. It's awesome that they were able to unilaterally make a breaking change to the language and force users to accept it moving forward. We can't do that in JS, that's the point I'm making.

[1] https://tip.golang.org/doc/go1.22

throwitaway1123··on The many faces of undefined in JavaScript
This is mostly conceptual rather than technical, but I view pragmas like use strict as an append operation. If browsers dropped sloppy mode completely and made strict mode the default for all scripts, then that would be a true delete operation. I wouldn't be surprised if browsers still support sloppy mode cruft like the with operator in 2034.
throwitaway1123··on The many faces of undefined in JavaScript
Some functions accept a callback and behave differently depending on whether or not the callback returns a value. If your callback is a single expression arrow function, then you might find it cleaner to just void the result instead of wrapping the body of the function in a code block (which prettier will format using multiple lines). Super contrived example:

  import { produce } from 'immer'
  
  let i = 1
  const a = produce({ x: 0 }, draftState => i++)
  const b = produce({ x: 0 }, draftState => void i++)
  const c = produce({ x: 0 }, draftState => {
    i++
  })
  console.log({ a, b, c }) // Logs: { a: 1, b: { x: 0 }, c: { x: 0 } }
The immer docs have a section about this pattern: https://immerjs.github.io/immer/return#inline-shortcuts-usin...
throwitaway1123··on The many faces of undefined in JavaScript
I've been following AssemblyScript for years but I can't recommend it until they figure out closures: https://github.com/AssemblyScript/assemblyscript/issues/798
throwitaway1123··on The many faces of undefined in JavaScript
> Most languages aren’t infinitely backwards-compatible so unless you want to be running Python 2.7 forever or whatever…

This is an important point that I think gets overlooked quite a bit in these discussions. Web tech is essentially append only — you can add things but it's incredibly difficult for a browser vendor to make a breaking change because no vendor wants to be perceived as the one that "breaks the Web". Even technologies that were never technically standardized like Web SQL end up sticking around for far too long. I'm not sure if many programming language communities would like to be constrained by this and the slow TC39 language proposal process.

throwitaway1123··on NPM and NodeJS should do more to make ES Modules easy to use
Go has the benefit of not having to reach a distributed consensus amongst a variety of individual browser vendors. Try compiling a large Go project with tinygo to get a glimpse of what it's like to have to deal with multiple independent runtimes [1]. If the browser vendors had been able to ship ES4 or ES5 with module support between 1999 and 2009, then Node probably would have implemented it from the very beginning, and there would be no dichotomy between CJS and ESM.

[1] https://github.com/evanw/esbuild/issues/1111

throwitaway1123··on NPM and NodeJS should do more to make ES Modules easy to use
You might just be using the node-fetch example as a stand-in to make your point about esm/cjs, but the fetch api is built in to Node (since v16.15) and is no longer even considered experimental as of Node 21+.

https://nodejs.org/docs/latest-v22.x/api/globals.html#fetch

throwitaway1123··on Ask HN: What are some iconic comments on HN?
Found the first one (using HN's Algolia search api) https://news.ycombinator.com/item?id=37803494
throwitaway1123··on Adobe users are outraged over vague new policy's AI implications
Every Black Magic app I've downloaded was through the Mac App Store, and I was never prompted to enter my password during installation. You do have to authenticate with the App Store itself to approve installation of any app, but that doesn't grant the app any special privileges — that's required for every App Store installation (even on the iPhone). If a company doesn't distribute their software through the Mac App Store, then they should just give me a DMG or a zip file with a .app bundle in it that I can drag into my applications folder. Many apps are distributed this way (VSCode for example).
throwitaway1123··on Adobe users are outraged over vague new policy's AI implications
As another commenter pointed out, administrator privileges are not required to install the overwhelming majority of apps. The idea that you have to blindly enter your admin password to edit an SVG file or tweak an image is patently absurd to me (my ire is directed at Adobe, not you). Comparable apps like Affinity Designer and Davinci Resolve don't require elevated privileges.
throwitaway1123··on What You Get After Running an SSH Honeypot for 30 Days
It's a tarpit that slowly sends a message to bots to keep them (and their bandwidth, memory, and CPUs) occupied: https://github.com/skeeto/endlessh?tab=readme-ov-file
throwitaway1123··on What You Get After Running an SSH Honeypot for 30 Days
> yes, they were standardized in the ol' good times :) If you have a limited amount of people/services connecting then it is manageable. But of course YMMV.

Agreed. I've never found it difficult to manage this. I already tend to configure SSH hosts in my ~/.ssh/config file anyway so that I don't have to remember every IP and port combination for every host I have access to when I want to use SSH (or something that relies on the SSH protocol like rsync or scp).

throwitaway1123··on Adobe users are outraged over vague new policy's AI implications
> Adobe is a virus. You cannot get rid of it [...] You can't veen close it from the process list without sacrificing 2 hours.

Yup. Last time I installed an Adobe app on a Mac it refused to install unless I entered an administrator password (and didn't describe why that was necessary), and then made itself persistent so that the Creative Cloud background process restarted whenever I rebooted the computer. Ended up downloading KnockKnock to figure out how it was persisting itself: https://objective-see.org/products/knockknock.html

throwitaway1123··on Ask HN: If you are starting in 2024, what is the most productive solo dev stack?
You could build a blog with Vite and @mdx-js/react, but that honestly might be overkill. Astro is definitely tailored towards the blog use case. Gatsby is another older framework that's oriented more towards building a blog, but I'm not a huge fan of how it insists on making you use GraphQL. Eleventy is another popular choice for JS powered static sites if you're not set on using React.
throwitaway1123··on Ask HN: If you are starting in 2024, what is the most productive solo dev stack?
Vite is the closest thing we have to a Create React App successor. It does most of what CRA did in its heyday, while subsisting on far fewer dependencies. Run `npm create vite@latest` and just follow the CLI prompts.
throwitaway1123··on Apple to Debut 'Passwords' App, in Competition with 1Password, LastPass
The Secretive SSH Agent uses it to store SSH keys: https://github.com/maxgoedjen/secretive
throwitaway1123··on Please support "skip to main content" on your docs site
Safari requires yet another setting to be toggled in order to allow tabbing between links [1]. Apple is normally at the vanguard when it comes to accessibility, but there are a few legitimate keyboard navigation quirks in Safari.

[1] https://www.mayank.co/blog/safari-focus#keyboard-navigation

throwitaway1123··on Cloudflare took down our website
They accidentally deleted a customer's account somewhat recently [1][2][3].

[1] https://news.ycombinator.com/item?id=40313171

[2] https://news.ycombinator.com/item?id=40304666

[3] https://news.ycombinator.com/item?id=40466810

throwitaway1123··on The problem with new URL(), and how URL.parse() fixes that
I often find myself using an immediately invoked function expression to handle the try catch const assignment issue, for example:

  const result = (() => {
    try {
      return new URL(someString)
    } catch {
      return null
    }
  })()
It's not pretty though, and I think the do expressions proposal would rid my codebases of this pattern: https://github.com/tc39/proposal-do-expressions
throwitaway1123··on Tim Cook is running out of ideas
> What kind of hobby can you pick up for less than $100?

You can publish an extension to the Chrome Web Store for a one time fee of 5$ (and you don't need XCode or a Mac to do it). You can build a website behind a login wall using social sign in via oAuth for free without building a homegrown authentication system (rather than paying 100$ a year for Sign in with Apple which doesn't even adhere to the oAuth spec properly).

throwitaway1123··on Redesigned 11-inch and new 13-inch iPad Air
> the only reason iPadOS stays locked down is that it's simply more profitable to sell a customer two devices instead of just one.

Not only do they want to sell you an iPad and a separate computer, but they would ideally like to sell your family multiple iPads, which is why you can't have more than one user account on an iPad (unless you have a business or educational account with Apple [1]).

[1] https://support.apple.com/guide/deployment/shared-ipad-overv...

throwitaway1123··on Are We Modules Yet?
> allows any transitive dependency to run arbitrary code on your machine at a time of installation

This point gets parroted so often on HN [1]. You can install packages with the --ignore-scripts flag to disable this behavior, or just set the option globally in your NPM config file. I do like the way Bun disables lifecycle scripts by default [2], but it takes me all of two seconds to run `npm config set ignore-scripts=true` on a new machine, so it's basically a non-issue for me.

[1] https://news.ycombinator.com/item?id=38797176

[2] https://bun.sh/docs/cli/install#lifecycle-scripts

throwitaway1123··on React 19 Beta
That's also baked into React: https://react.dev/reference/rsc/use-client
throwitaway1123··on React 19 Beta
Hidden amongst all those updates is the fact that React finally supports custom elements. Advocates of web components can finally just say "web components work in every framework" without adding any disclaimers about React [1].

[1] https://custom-elements-everywhere.com/

throwitaway1123··on HTML Attributes vs. DOM Properties
Yes, I know. I wasn't making a prescriptive comment about whether or not developers should use properties, I was just making a descriptive comment about how properties are accessed in a web component to answer the specific question politelemon asked.
← PreviousPage 6 of 11Next →