News for hackers. Stuff that matters.

mdc2161

Re:JavaScript best practice: use return await on Friday March 07, 2025 @05:39PM (#43295580)
It is very much not being turned into synchronous code. There are a lot of reasons to use async code, and they're all still valid with this pattern.

For example:

- the event loop is still not being blocked

- the calling code can still be flat instead of nested callbacks (truly synchronous) or chained `.then` calls

Is it a little bit more boilerplate? Yes, definitely, and it's certainly less nice to look at. But it's linter-enforceable consistency that removes the cognitive overhead of an annoying to debug footgun.

Note: My favorite style is typed error returns instead of thrown exceptions. In that world, you only need try/catches at the boundaries of your code and for application crashing exceptions. Unfortunately most codebases aren't written like that and I'm often working in inherited code instead of greenfield.

Re:JavaScript best practice: use return await on Friday March 07, 2025 @03:23PM (#43294138)
If the inner function is async, then its callers need to be async as well (see https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...).

Important to note that unless the inner function throws an exception, the two versions are essentially identical, even sharing (if using typescript) a return type definition of `Promise<ReturnType<InnerFunction>>`.

That's because `await` flattens nested promises, so both `Awaited<Promise<T>>` and `Awaited<Promise<Promise<Promise<T>>>>` resolve to `T`.

Re:JavaScript best practice: use return await on Friday March 07, 2025 @02:09PM (#43293242)
Strong agree based on my experience.

Worth noting that this is easily enforceable with eslint: https://typescript-eslint.io/rules/return-await/

Re:AI is going to hack Jira on Friday March 07, 2025 @10:10AM (#43290759)
> Engineering productivity can’t be measured by tracking new features.

Garbage in, garbage out. And as a measure of engineering productivity, story points/feature count/Jira are pretty much garbage!*

Back in 2013 when I was doing consulting for Fortune 500s, even the "Agile practitioners" on our team got carried away abusing Jira and story points to do crazy cross-team comparisons and micromanagement. And these were exactly the people that were supposed to know better! That's what they being paid for, after all.

There are many things that should be purely internal measures within a team, yet anything quantified and easily accessible is always rife with misuse. Can't imagine how much worse that will be once AI makes even more of that surface area accessible, and worse yet can gamify its output to outperform on such measures.

* Story points can have value within a team, but that's a separate discussion

Apple's numbers here are a lot better than I expected!

For comparison, many of the other FAANG companies fare much worse, and many of the smaller companies I saw when consulting and doing a startup looked even less diverse than big tech.

https://www.cnbc.com/2020/06/12/six-years-into-diversity-rep...

If he were a comedian, I believe he would be given more slack (assuming he changed the tenor of his jokes in the intervening years).

As a manager, as someone responsible for others' livelihoods and careers, he has to be held to a much higher bar. Even if it were purely in jest, is it fair to have his direct reports try to figure out the line between what he publicly writes and privately believes?

> People who express disdain towards the current social structure and disparage groups like white men get hired left and right

Have you seen _any_ major tech company with close to 50% women or 40% non-hispanic white employees? In engineering roles? That's just aiming for parity with U.S. demographics, but when you consider how much of the world travels to the U.S. to work in tech, that 40% number should be much higher!

So if women and minorities are not being "hired left and right", and not all women and minorities ascribe to the viewpoint you describe, then that viewpoint cannot be being "hired left and right".

The "old social structures" may be on their way out, but their vestiges are clearly alive and well despite the moderate legal "risk" that has been added in the past few decades. The law may be an asymmetric tool, but as it stands, a tool that isn't up to the task it was designed for.

---

To reframe things, some questions:

How would you define "the old social structures".

Do you think they are good/bad/benign.

Do you they are still present/fast fading/already gone?

Re:Accessing Gitlab Returns 403 on Tuesday May 19, 2020 @01:45PM (#23237802)
Git push and pull on gitlab repos is down, returning 403s. This is breaking CI pipelines as well.
Re:O-bahn Busway on Wednesday December 19, 2018 @05:43PM (#18720578)
Seems similar to the guide-wheel system shown in the Boring Company's demo yesterday: https://www.wired.com/story/elon-musk-boring-company-car-fli...

It seems the Boring Company expects much higher top-end speeds, however. Perhaps smaller vehicles and autonomous driving will help with that.

Re:Ask HN: Freelancer? Seeking freelancer? (May 2018) on Tuesday May 01, 2018 @01:04PM (#16968918)
SEEKING WORK | NYC or REMOTE | FULL-STACK, REACT NATIVE

My preferred stack is Typescript, React Native, Node Koa, and PostgreSQL, but I'm productive in a number of other technologies.

I've spent the last few years building React Native apps, both as a freelancer and as a senior developer at a venture-backed startup.

Before that, I had a range of experiences including working for McKinsey Digital and founding a startup (500 Startups Batch 13).

Here's a work sample from one of my side projects: http://emersonjournal.com/

Email [email protected]

Re:Apple Buys Shazam to Boost Apple Music on Monday December 11, 2017 @02:49PM (#15899758)
It's definitely not just the top charts. Notably it has picked up when someone near me was playing Chopin on a piano as well as the occasional KPop tune my girlfriend is listening to.

My guess is it supplements the data with songs from your Google Music and youtube history.

Re:Why do so few people major in computer science? on Monday May 29, 2017 @03:22PM (#14440906)
Personal anecdote: I didn't major in it because I had no idea I would enjoy it.

I was fortunate that my engineering program had two semesters of Java. We spent more time hand drawing logic gates than coding in the intro course and so it wasn't until the second (data structures) that I realized it was something I wanted to pursue. It was too late for me to change majors at that point, but not too late to take internships and then a job as a programmer.

Re:International Travel Guide for Basecamp employees on Wednesday May 03, 2017 @11:00AM (#14256232)
I ran into this a lot while crossing the border into Canada as a consultant, I presume it is similar crossing the border in the other direction.

Internal business meetings did not require a work visa, while meetings with one of our clients did.

Dealt with similar issues as both a host and a guest.

The biggest problem to me is poor expectation setting. There are hosts that run BnB quality services, ones that run a mock-hotel like you described, and ones that just rent out a spare room in their apartment.

As a guest, it'd be great to know what I'm walking into. As a host, having guests that understand they are staying in my home and NOT a hotel would be great.

My guess is, dividing up the listings into service tiers would lead to legal issues (like you saw last year in NYC), but it would surely help with the guest-host relationship.

If you like whoaremyrepresentatives, we would love feedback on [Act On This](https://www.actonthis.org/) as well.

We don't go down to as local of a level yet, but are more focused on giving information about specific actions you can take related to issues you care about.

While the current list of issues comes from us, we're on-boarding a couple of non-profits so they can use the tool to help organize volunteers at a state and local level.

Re:Mr. Robot Killed the Hollywood Hacker on Wednesday December 07, 2016 @05:21PM (#13126805)
> Use SQL to corrupt their databases!

Use alphabet to write this comment!

A few counter points:

- hardware exclusives may be a better business model, but consumers (at least a vocal subset) clearly don't like them

- Microsoft seems to be moving towards having all Xbox games run on pc so console exclusives may be on their last legs

- the vr market is relatively tiny, so splitting it up with exclusives will make it harder for devs to justify making content

- game margins are much higher than vr hardware, and do it may be better to have store exclusives rather than hardware (something steam is doing without the backlash)

Re:Two Weird Tricks with Redux on Wednesday April 13, 2016 @12:00PM (#11489358)
It works great, too, for abstracting away fetch logic to middleware (as in this blog post) or to a shared module.

And it is in the redux tutorials, but buried in the advanced section. http://redux.js.org/docs/advanced/AsyncActions.html

Re:Two Weird Tricks with Redux on Wednesday April 13, 2016 @11:44AM (#11489153)
I just started with redux-saga which uses ES6 generators to handle app control flow.

After first impressions, I'd say it's worth a look if you're running into anything near as complicated as talked about here. It's very easy to reason about and test. gaearon - the creator of redux - seems to approve of it as well.

https://github.com/yelouafi/redux-saga

Re:React.js Conf live stream [video] on Monday February 22, 2016 @08:08PM (#11155682)
Our team threw this together in a couple weekends when we were test driving react native: https://itunes.apple.com/us/app/emergency-kittens-adorable/i...

The ability to reuse code is very real, even sharing a lot with a web react app since most state/business logic is in some flux implementation.

The pain points (documentation, build process, etc.) are real, too, but things I can forgive for now due to its newness and its very strong foundation.

Re:Lyft Files to Raise as Much as $1B on Monday December 21, 2015 @09:20PM (#10775323)
Well I guess that could explain the 50% off rides promo they've been running in NYC for the past 6 weeks. Seems like every Sunday I get a push notification that it is extended.
Re:Things to Avoid When Writing CSS on Monday October 26, 2015 @09:46AM (#10451347)
"Then, when I wanted to scale things up at a min-width breakpoint, I’d just adjust the root font size, upon which everything else is proportionately based."

The problem is that scaling everything up or down proportionally looks bad. https://css-tricks.com/rems-ems/

Re:YC Stats on Wednesday August 26, 2015 @01:16PM (#10124491)
another stat from sama on twitter:

> Oh, another important stat: about 300 of the companies we have funded have shut down.

Re:The Problem with Job Titles on Tuesday February 17, 2015 @01:20PM (#9063983)
really cool data in those distributions, definitely spent way too much time flipping back and forth from one tab to another. Maybe unsurprisingly, javascript is every groups' most reported skill and full-stack engineers tend to be more senior. It'll be exciting to watch as your data set grows
Re:The Problem with Job Titles on Tuesday February 17, 2015 @11:49AM (#9063256)
Great underlying data, but sad to see it visualized as radar charts.

- Each category majorly affects the reading of the category next to it, which isn't helpful in non-sequential categorizations

- The difference between two adjacent categories creates a unique angle and shape that is purely extraneous information

- The relative sizes are hard to read as the underlying quantities aren't proportional to the displayed areas

Although not the prettiest possibility, a grouped column chart (maybe groups for front-end, back-end, maintenance, culture, etc.) is a simple example that avoids many of these issues and has very good readability at a glance.

Older »