frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Apache Poison Fountain

https://gist.github.com/jwakely/a511a5cab5eb36d088ecd1659fcee1d5
1•atomic128•38s ago•0 comments

Web.whatsapp.com appears to be having issues syncing and sending messages

http://web.whatsapp.com
1•sabujp•1m ago•1 comments

Google in Your Terminal

https://gogcli.sh/
1•johlo•2m ago•0 comments

Shannon: Claude Code for Pen Testing

https://github.com/KeygraphHQ/shannon
1•hendler•2m ago•0 comments

Anthropic: Latest Claude model finds more than 500 vulnerabilities

https://www.scworld.com/news/anthropic-latest-claude-model-finds-more-than-500-vulnerabilities
1•Bender•7m ago•0 comments

Brooklyn cemetery plans human composting option, stirring interest and debate

https://www.cbsnews.com/newyork/news/brooklyn-green-wood-cemetery-human-composting/
1•geox•7m ago•0 comments

Why the 'Strivers' Are Right

https://greyenlightenment.com/2026/02/03/the-strivers-were-right-all-along/
1•paulpauper•8m ago•0 comments

Brain Dumps as a Literary Form

https://davegriffith.substack.com/p/brain-dumps-as-a-literary-form
1•gmays•9m ago•0 comments

Agentic Coding and the Problem of Oracles

https://epkconsulting.substack.com/p/agentic-coding-and-the-problem-of
1•qingsworkshop•9m ago•0 comments

Malicious packages for dYdX cryptocurrency exchange empties user wallets

https://arstechnica.com/security/2026/02/malicious-packages-for-dydx-cryptocurrency-exchange-empt...
1•Bender•9m ago•0 comments

Show HN: I built a <400ms latency voice agent that runs on a 4gb vram GTX 1650"

https://github.com/pheonix-delta/axiom-voice-agent
1•shubham-coder•10m ago•0 comments

Penisgate erupts at Olympics; scandal exposes risks of bulking your bulge

https://arstechnica.com/health/2026/02/penisgate-erupts-at-olympics-scandal-exposes-risks-of-bulk...
4•Bender•10m ago•0 comments

Arcan Explained: A browser for different webs

https://arcan-fe.com/2026/01/26/arcan-explained-a-browser-for-different-webs/
1•fanf2•12m ago•0 comments

What did we learn from the AI Village in 2025?

https://theaidigest.org/village/blog/what-we-learned-2025
1•mrkO99•12m ago•0 comments

An open replacement for the IBM 3174 Establishment Controller

https://github.com/lowobservable/oec
1•bri3d•15m ago•0 comments

The P in PGP isn't for pain: encrypting emails in the browser

https://ckardaris.github.io/blog/2026/02/07/encrypted-email.html
2•ckardaris•17m ago•0 comments

Show HN: Mirror Parliament where users vote on top of politicians and draft laws

https://github.com/fokdelafons/lustra
1•fokdelafons•18m ago•1 comments

Ask HN: Opus 4.6 ignoring instructions, how to use 4.5 in Claude Code instead?

1•Chance-Device•19m ago•0 comments

We Mourn Our Craft

https://nolanlawson.com/2026/02/07/we-mourn-our-craft/
1•ColinWright•22m ago•0 comments

Jim Fan calls pixels the ultimate motor controller

https://robotsandstartups.substack.com/p/humanoids-platform-urdf-kitchen-nvidias
1•robotlaunch•25m ago•0 comments

Exploring a Modern SMTPE 2110 Broadcast Truck with My Dad

https://www.jeffgeerling.com/blog/2026/exploring-a-modern-smpte-2110-broadcast-truck-with-my-dad/
1•HotGarbage•25m ago•0 comments

AI UX Playground: Real-world examples of AI interaction design

https://www.aiuxplayground.com/
1•javiercr•26m ago•0 comments

The Field Guide to Design Futures

https://designfutures.guide/
1•andyjohnson0•27m ago•0 comments

The Other Leverage in Software and AI

https://tomtunguz.com/the-other-leverage-in-software-and-ai/
1•gmays•29m ago•0 comments

AUR malware scanner written in Rust

https://github.com/Sohimaster/traur
3•sohimaster•31m ago•1 comments

Free FFmpeg API [video]

https://www.youtube.com/watch?v=6RAuSVa4MLI
3•harshalone•31m ago•1 comments

Are AI agents ready for the workplace? A new benchmark raises doubts

https://techcrunch.com/2026/01/22/are-ai-agents-ready-for-the-workplace-a-new-benchmark-raises-do...
2•PaulHoule•36m ago•0 comments

Show HN: AI Watermark and Stego Scanner

https://ulrischa.github.io/AIWatermarkDetector/
1•ulrischa•36m ago•0 comments

Clarity vs. complexity: the invisible work of subtraction

https://www.alexscamp.com/p/clarity-vs-complexity-the-invisible
1•dovhyi•37m ago•0 comments

Solid-State Freezer Needs No Refrigerants

https://spectrum.ieee.org/subzero-elastocaloric-cooling
2•Brajeshwar•38m ago•0 comments
Open in hackernews

A job queue in two lines of JavaScript

https://jameshfisher.com/2025/07/07/a-job-queue-in-two-lines-of-js/
57•chmaynard•7mo ago

Comments

lerp-io•6mo ago
The chain variable continuously grows because each call to enqueue() creates a new promise that references the previous one. This creates an ever-growing chain of promises that never gets garbage collected.
ath92•6mo ago
Couldn’t the browser garbage collect the promises (and their callbacks) that have been rejected or resolved? I.e. effectively “shift” the promises at the start of the queue that have been dealt with and will never be relevant again?

At least this stackoverflow answer suggests the handlers are GC’ed: https://stackoverflow.com/questions/79448475/are-promise-han...

jameshart•6mo ago
Why does the promise returned by a promise’s then() method need to reference that promise?

The original promise needs to reference the chained promise, not the other way round.

As jobs complete I would expect the top of the chain to be eligible to be garbage collected.

paulddraper•6mo ago
Though it seems like that, no.

  a = b.then(c);
When `b` is resolved, it is garbage collected, even if a reference to `a` is retained.

(If the runtime maintains async stack traces, that could be an issue...but that is a common issue, and the stack depth is limited.)

bapak•6mo ago
That's not how promises work, there's no chain. It's no different from

    await job1()
    await job2()
    await job3()
    await job4()
Except dynamic
ameliaquining•6mo ago
At least in V8, this is not the case. To prove it, start a Chromium-based browser with the command-line flag --js-flags=--expose-gc, then go to https://runjs.app/play/#aWYgKCF3aW5kb3cuZ2MpIHsKICB0aHJvdyBu...
bigiain•6mo ago
> This creates an ever-growing chain of promises that never gets garbage collected.

Modern frontend development performance best practise is to allow for garbage collection only when the browser crashes.

moralestapia•6mo ago
Nope.
Inviz•6mo ago
I wonder if people who are claiming its not the case ever tried to use promises in hardcore ways like this, chaining 10s of thousands of calls. You often hit some bullshit, i.e. Promise.race is a big cause of issues.

Even if you are doing `then().then()`, something _else_ in the code base could retain the promise somehow and then your whole chain isn't GCable!

For example https://github.com/rxaviers/async-pool library that implements concurrency for async iterators (and uses promise.race) subtly creates GC pressure which you dont see until you make a whole lot of calls and suddenly its slow

gabrielsroka•6mo ago
That's TS, not JS.
90s_dev•6mo ago
For now.

https://github.com/tc39/proposal-type-annotations

jameshart•6mo ago
One line of TS, then two lines of JS (with a type annotation in one of them)
goloroden•6mo ago
It’s not even 2 lines:

1. Type definition 2. Chain definition 3. Enqueue definition

jakelazaroff•6mo ago
Line 1 is fully erased when transpiling, leaving two lines of JavaScript.
Brian_K_White•6mo ago
But you still had to write it and it's required to get the result, so I don't see any rational for not counting it.

Transpilation does not change the fact that the input is these 3 lines of code in 2 different languages.

jakelazaroff•6mo ago
Right, and only two of those lines are JavaScript. The type definition is not required to get the result.
metadat•6mo ago
I noticed the same thing when I saw the code. Is it honest for TFA to title it as "2-lines of Javascript" in this case?
dcre•6mo ago
Oh, come on.
egorfine•6mo ago
I came here to make the same comment.

I wonder why are you downvoted for being as factual and neutral as it is technically possible.

ameliaquining•6mo ago
I think because a reader who doesn't want to use TypeScript can trivially remove the type annotations, so they're not actually a barrier to using this code in JavaScript. Some people might also be suspicious that the reason to bring this up is to imply hostility to JavaScript tooling that requires a build step, since it's become popular to hate on this.
egorfine•6mo ago
So as a community of developers we're totally okay calling TypeScript "JavaScript" because ... mentioning that hard cold fact is a sign of hostility towards TS? Ok. Got it.
90s_dev•6mo ago
I came across this trick a few months ago when I was dealing with what seemed to be a race condition from a chrome-only API, and I just felt so clever! I don't remember though whether the race condition actually was one or not though, and I eventually had to rip that entire class out of my codebase. But it's such a good feeling to know I came up with a solution that clever all by myself.
Inviz•6mo ago
Chaining promises like this is not a good idea for high throughput cases (creates gc pressure), but perfectly valid for regular cases.
paulddraper•6mo ago
Huh?

It creates 1 object allocation per enqueue.

Inviz•6mo ago
yeah but it creates closure as well, which typically references some objects that isn't easy to GC. So if you have long-living promise with some data captured in closure, it will not be cleared. So doing then().then().then() may not release objects referenced in callbacks that resolved time ago.
paulddraper•6mo ago
There are zero closures here.
vivzkestrel•6mo ago
A production grade application would need a much more robust mechanism like BullMQ
ameliaquining•6mo ago
There are use cases for a non-persistent task queue, like doing things one at a time on the frontend. (JavaScript is single-threaded but will interleave multiple separate async call chains that each span multiple event-loop iterations, and there could be situations where you might not want that.)
theThree•6mo ago
Something like this?

async function runTasks(tasks: Job[]) { for (let task of tasks) { try { await task() } catch (e) { } } }

foxygen•6mo ago
This only works if you have the full list of tasks beforehand.
neals•6mo ago
Anybody willing to walk me through this code? I don't get it.
foxygen•6mo ago
chain is a global variable. It starts with an empty promise. First call to enqueue changes the (global)value of chain to emptyPromise.then(firstJob), second call to enqueue changes it to emptyPromise.then(firstJob).then(secondJob) and so on.
fwlr•6mo ago
JavaScript promises are objects with a resolver function and an internal asynchronous computation. At some point in the future, the asynchronous computation will complete, and at that point the promise will call its resolver function with the return value of the computation.

`prom.then(fn)` creates a new promise. The new promise’s resolver function is the `fn` inside `then(fn)`, and the new promise’s asynchronous computation is the original promise’s resolver function.

cluckindan•6mo ago
If you wanted to e.g. log something on failures, you’d need to do something like this:

    chain
      .then(job)
      .catch((err) => {
        console.error(err);
        return job();
      });
Otherwise failures would need to be logged by the job itself before rejecting the promise.
egorfine•6mo ago
> If you need a job queue in JS

  type Job = () => Promise<unknown>;
This is not JS.
ameliaquining•6mo ago
It's trivial to remove the type annotations.
ameliaquining•6mo ago
To make it slightly more idiomatic, you can use chain.finally(job) instead of chain.then(job, job). (All browsers have supported this API for over seven years.)