HNHacker News
TopNewBestAskShowJobs

phpnode

7,416 karma · joined October 23, 2009

Founder of https://codemix.com/ - authoritative product context which makes sure coding agents build the right thing and humans stay in control.

Email: charles@codemix.com

submissionscomments
phpnode··on Developer hiring and the market for lemons
Computerised spreadsheets were inevitable, we've been using spreadsheets in some form for thousands of years. Visicalc is recognised as being the first, but Excel has been the dominant product for decades now, for all its warts it has had a massive impact on humanity.
phpnode··on Runtime Introspection of Flow Types in JS
Cool article. I'm the author of https://github.com/codemix/babel-plugin-typecheck mentioned and the next version of the plugin (WIP) takes this kind of approach, so that you can reference a type at runtime:

    type User = {name: string, isAdmin: boolean};

    // compiles to
    const User = t.object(
      t.property('name', t.string()),
      t.property('isAdmin', t.boolean())
    );

    // which you can then use with
    User.check({name: 'Alice'}); // boolean
    User.assert({nom: false}); // throws

Ultimately it should be possible to use this to implement pattern matching in JS based on flow types, for example:

    type User = {
      name: string;
      roles: Role[];
    };

    type Role = {
      id: number;
      name: string;
      users: User[]
    };

    const url = match(someInput, 
      (user: User) => `/users/${user.name}`,
      (role: Role) => `/roles/${role.id}`,
      (_) => `/` // default URL
    );
The really hard thing is to do this whilst maintaining perfect compatibility with flow.
phpnode··on Implication of sabotage adds intrigue to SpaceX investigation
It's a full dress rehearsal, the only difference between static fire and a real launch is that they do not release the hold-down clamps and shut down the engines instead. The cameras would have been rolling.
phpnode··on If TypeScript is so great, how come all notable ReactJS projects use Babel?
> Aren't the Babel people trying to define a common standard format for the AST so different parsers and code generators can better work together?

Actually kind of the opposite - babel used to use the common ESTree AST format, but they've moved away to something similar but incompatible.

phpnode··on The longer passwords in the Last.fm database
It's not a random sequence of characters, there are only 12 words in there. The cracker is trying words, not just random bytes and so the search space is much smaller
phpnode··on The longer passwords in the Last.fm database
Rainbow tables aren't really a thing any more, you can calculate a hash much faster than you can download one
phpnode··on How to steal a developer's local database
That's a very different attack vector to the one in this post - buffer overflow vs legit service running on open ports unbeknownst to the user
phpnode··on 4WD vs. AWD. What's the Difference?
Still waiting for you to make good on this promise :)
phpnode··on G.E., the 124-Year-Old Software Start-Up
GDC = Global Development Centre
phpnode··on 4WD vs. AWD. What's the Difference?
We're all here to learn, if you've got some insight into what the article got wrong then why don't you school us?
phpnode··on Looks Can Kill: The Deadly Results of Flawed Design
Looks refreshing! http://d2ydh70d4b5xgv.cloudfront.net/images/2/c/vintage-mark...
phpnode··on RDL: a lightweight system for adding contracts to Ruby
I've never seen a type system expressive enough to cover all the things that contracts can do, e.g does a type system exist which can assert the existence and size of a particular file on disk?
phpnode··on RDL: a lightweight system for adding contracts to Ruby
Contracts are just structured assertions, they're very similar.
phpnode··on RDL: a lightweight system for adding contracts to Ruby
Your argument seems more like one against transpilers in general.

Contracts are useful during development, they're typically stripped out in production builds, so there's no performance overhead there. If you find a bug in production, turn on your contracts and you'll quickly discover the source of the error. Contracts can validate the state of the world at runtime in a way that can never be covered by unit tests, unless your tests cover all possible inputs to your program. It doesn't mean you don't need unit tests too, they are yet another layer of safety.

I use this in combination with Flow, which means I have to transpile regardless, so the overhead is very low for me. Of course I'd like them to be part of the language proper, but for that to happen there needs to be developer demand first.

phpnode··on The meeting that showed me the truth about VCs
Limited Partners
phpnode··on RDL: a lightweight system for adding contracts to Ruby
It's definitely most useful when combined with type annotations. They're complementary tools, annotations can ensure type safety at compile time, but type safety is only one part of program correctness, whereas contracts can validate just about any aspect of program operation because they have access to all of the runtime information. They're like unit tests that run all the time (until you strip them in production at least).

This thing can be used alongside Flow[0] and other babel plugins which use flow syntax.

[0] https://flowtype.org/

phpnode··on RDL: a lightweight system for adding contracts to Ruby
It's always baffled me why more people don't seem interested in adopting design by contract, it is a ridiculously powerful tool for writing quality software.

Here's a Babel plugin which adds design by contract to JavaScript, squeezing it into existing JS syntax (the result is really similar to Eiffel) - https://github.com/codemix/babel-plugin-contracts

and here's what it looks like in a reasonably complicated program - https://github.com/codemix/malloc/blob/master/src/index.js

(disclosure: I wrote this)

phpnode··on Inside font-rs, a font renderer written in Rust
No SIMD intrinsics yet
phpnode··on We need to call American breakfast what it often is: dessert
Fried. Not deep fried. No one would do that.
phpnode··on Brexit: Berlin eyes Britain’s tech talent
You wanted to open a bank account in Germany, yet couldn't ask even the most basic questions in German? And you characterise this as a failing of the other party (the bank)? That is insane!
phpnode··on An interactive way of blogging about JavaScript
I think you'd run into escaping issues like that. It would have to be:

    <JavaScript src={`[1, 2, 3].map(n => n + 1)`} />
phpnode··on This is not a place of honor
Do you have a link to that poem?
phpnode··on Mark Zuckerberg's Twitter and Pinterest password was 'dadada'
It bothered me more than it should have that you used isuckat@passwords.com instead of isuck@passwords.com for your example :)
phpnode··on Mark Zuckerberg's Twitter and Pinterest password was 'dadada'
That doesn't need to be true for this to have happened. Zuck is a high profile target, probably the hackers just prioritised cracking his account and such a weak password would be found reasonably quickly even using bcrypt
phpnode··on Async and Await
You are asking a question, I do not owe you an answer, it's up to you to find out whether this stuff matters for your use case. I've done these tests myself, it is trivial for you to do the same. Do your own homework.
phpnode··on Async and Await
By the same token, why do I owe you any further evidence?
phpnode··on Async and Await
Check out the Bluebird benchmarks [0], or you can easily try it for yourself - create a simple web server which does some makework async task, like stating a bunch of files, then benchmark with ab or something better.

[0] https://github.com/petkaantonov/bluebird/blob/master/docs/do...

phpnode··on Async and Await
The call itself is relatively expensive, but as you say it's a one off call at startup time and the methods it produces are faster than explicit promisification using `new Promise`, they are blazing fast :)
phpnode··on Async and Await
Bluebird's `promisifyAll()` is just a way to generalize that pattern, so that you don't need to write it yourself. And if you care about performance it's substantially faster too. If you want to learn about the pattern then fine, but personally I don't want to write that for every single `fs` function I use in a project, it's much more convenient to just `Bluebird.promisifyAll(require('fs'))`.
phpnode··on Async and Await
Presumably instances of `MyObject` can be accessed by functions which are running while this function is suspended, waiting for the network call. It's single threaded, as in only one thing happens at a time from JS's point of view, but other functions can be invoked (by a request coming in, or a UI event etc) while an asynchronous operation is awaiting completion.
← PreviousPage 23 of 34Next →