HN user

the_imp

153 karma

-

Posts0
Comments49
View on HN
No posts found.

In JavaScript, use https://www.npmjs.com/package/yaml for this:

    import assert from 'assert'
    import { parseDocument } from 'yaml'
    
    const flowDoc = parseDocument(`[1,2,3]`)
    flowDoc.add(4)
    assert(flowDoc.toString(), '[ 1, 2, 3, 4 ]\n')
    
    const blockDoc = parseDocument(`\
    - 1
    - 2
    - 3`)
    blockDoc.add(4)
    assert(
      blockDoc.toString(),
      `\
    - 1
    - 2
    - 3
    - 4
    `
    )
Git is too hard 6 years ago

Why can't there be an equivalent of stash that keeps track of which parts were added and which weren't?

But git stash does keep track of what it added?

If switching branches wouldn't conflict with my current change, why do I have to stash/checkout/unstash instead of just doing it?

If your current changes apply to files which haven't changed between said branches, you don't need to stash your changes when switching between them.

Why can't I pull without fetching?

The command for that is `git merge`.

Why will none of the 5 or so push configurations just do "push the current branch to the branch of the same name on the remote"?

The command for that is `git push origin HEAD`.

Why is there no way to stop git from setting master as the upstream every time I do git checkout -b myfeature origin/master?

The option for that is `--no-track`.

Why do I have to detach from a branch before deleting it?

Because the `git branch` command never changes the working tree, which in this case uses the branch name to identify its location. If the branch were to be deleted without first detaching (or switching to a different branch), stuff would break.

To clarify/correct this a bit, Webpack is not funded by the OpenJS Foundation. Yes, it is an OpenJS project, but the foundation does not provide financial support for open-source development. It does provide legal, marketing, and other support, as well as being able to assist with infrastructure costs, but it's still up to each project to separately run (or not) their own fundraisers and other funding activities.

Also, it would be incorrect to say that the foundations "picks software" such as AMP; instead, projects apply to join. The decision to accept AMP was made entirely without consideration for Google's status as a sponsor of the foundation. And finally, while it may count as splitting hairs, Google retains ownership and control of the AMP cache; it's the core technologies that have been transferred to the foundation, not the instance run by Google that relies on those technologies.

The whole model of needing to own your own transportation devices is flawed.

9/10 times, I'm moving from one location with many other people in it to another location with many other people. I would prefer not needing to own any medium in order to move between them, but instead be able to use a public service to do so. Bus, tram, metro, citybike, scooter. I'd really rather not own stuff with really high capital costs, like cars.

At this point, the only reason to own anything more expensive than a bike is bad city planning and infrastructure.

Do note that in addition to block collections, YAML also supports the flow collections of JSON, which are not whitespace sensitive. In fact, YAML 1.2 is a superset of JSON, and you can parse JSON with # comments as entirely valid YAML.

To be clear, both of those issues are just with YAML 1.1. The core schema of YAML 1.2 dropped parsing "no" as true, or (as you mentioned) colon-separated numbers as sexagesimal integers. But yeah, unfortunately a number of libraries that only support 1.1 are still being used.

On Cash 8 years ago

The current Finnish solution for this problem is to use one of the two mobile payment services that allow person-to-person payments using a phone number as the identifier:

https://siirto.fi/

https://www.mobilepay.fi/

Admittedly these aren't anonymous as the recipient will get your name and phone number, but the convenience is arguably even greater than what's possible with cash.

Over the past few months, I've built up a somewhat masochistic relationship with YAML, as I've been writing my own JS library for it [1]. Yes, the spec is more complicated than it ought to be and yes, writing yet another implementation might just mean more overall variance within the spec, but it's still the only config language with decent usage that supports human-readable multi-line strings and comments. And it would've been really nice if someone else had supported editing comments, so I wouldn't have needed to do that myself.

Still, I'm optimistic, especially now that Prettier is getting YAML support. [2]

[1] https://eemeli.org/yaml/

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

Not quite. The 25 km/h limit is just for the bike's classification as a "bicycle"; electric bikes that go faster than that just need to get registered and are effectively treated as mopeds under traffic laws.

The data looks like it could lend itself to an approach where you model the error rate based on the prior data (at simplest, get a mean and variance out of it) and then use a Chi-square critical range check to see if the last n (degrees of freedom in the check) measurements are likely to have come out of the modelled distribution. Is that something you've considered?