Better HN
topnewbestaskshowjobs
Log inSign up

codebrrr

13 karma · joined Dec 29, 2023 (2y ago) · 4 submissions

Submissions

comment 2y ago · link · parent

The computerized flat knitting machines are even more genius.

I like to call them clothes printers.

comment 2y ago · link · parent

On Windows the Twitter, Instagram, TikTok apps are PWAs. I like to use them because I can pin them to the start menu, have them start on a separate window by default and remember the window position.

comment 2y ago · link · parent

Let's invent a new one: throw a CPU towards a motherboard. It must land in the socket in the proper orientation. Furthest distance wins.

comment 2y ago · link · parent

I'm pretty sure the following optimization is invalid, since a is not a bool array, but one of positive/negative numbers (see top of article):

> You can use arithmetics to go branchless.

    if (a[i] > 0) {
       cnt++;
    }
> Rewriting using arithmetic takes advantage of the fact that the expression a[i] > 0 has an arithmetic value 1 if true and 0 if false. So the whole expression can be rewritten as:

    cnt += a[i]