Programming

Would it be cleaner to accumulate on a nested list and a current chunk, and push the current chunk on every false predicate? Then you can just filter out the empty lists after the reduce.

EDIT: Like this:

source.reduce(([nested, currentChunk], item) => {
  if (test(item)) {
    currentChunk.push(item);
    return [nested, currentChunk];
  } else {
    nested.push(currentChunk);
    return [nested, []]
  }
}, [[], []]).filter(chunk => chunk.length > 0);

I realise this isn’t the troubleshooting thread but I need serious help on an issue that is driving me insane. My girlfriends computer keeps scrolling up forever on the windows start menu (and in other random situations that are really frustrating) I’ve tried unplugging all the hardware, I’ve tried various fixes from google including making a new user account and making sure background scrolling isn’t ticked I’ve restarted in safe mode and it still does it. I just reinstalled windows and it’s still happening. Hilariously it used to scroll down forever but recently it started scrolling up forever instead. It is breaking my brain plz halp!

Sounds like a hardware issue.

I had the same issue and was caused because I had a game controller plugged into the computer that had fallen off my desk and was leaning on one of the joysticks. But if you’ve unplugged everything that doesn’t sound like it. How many mice have you tried?

1 Like

2 and yeah that was my first thought because it happens to me quite often. Wish it were that simple.

Could be a damaged connection/port

I wish I had found the game controller before the reinstall of Windows… at least it was my game machine so nothing was lost. Jmakin has a point, have you been plugging the mice into different ports?

It does it even when the mouse isn’t plugged in. I pull the start menu down to halfway then yank the mouse and it just scrolls all the way back up.

Maybe a wireless controller somewhere? Or a piece of something stuck under the keyboard.

2 Likes

Holy crap. You done it. A fucking bluetooth controller. Man you guys rock so hard.

2 Likes

Any iOS devs around here? I may have a side project.

It seems like a tiktok-ish thing, so I assume it would need serious animation, graphics and sound integration skills. Which is why I’m not going to try to YOLO it myself.

1 Like

That gets a super like, that’s an amazing reference

Is it OK/idiomatic to use IIFEs in modern JS (TS if it matters)? My use-case is pretty dumb, I’m mostly just curious. I want to make a Map that’s keyed by a pair of numeric ids. The natural solution of [id1, id2] is a silent error (thanks JS!), so my initial hacky approach was to combine the ids as id1* BIG_CONST + id2. BIG_CONST seems like it should live in its own namespace, so I made an IIFE that returns an object IdPair with pack and unpack methods that reference the constant via closure. (After further consideration, I think the answer is just to stringify/parse the array, but ignore that for the moment…)

Would it be better to do this with a class or a module?

Module if its reused somewhere, otherwise IIFE is fine. I still use IIFEs when the alternative is a giant nested ternary. I haven’t made a class outside of React in 10 years.

1 Like

I’ve been doing JS for 22 years and have almost never rolled my own object-oriented JS. I use whatever the idiom the framework provides or I don’t do it. I hate the class-based vs. prototypical inheritance question - because I have no feel for it IRL. I’m just regurgitating something I don’t really fundamentally grasp.

I had to walk a dev through some command line stuff and he didn’t know the $ notation was the shell prompt, so he kept telling me none of the commands were working and didnt know why. He was just copy pasting the entire line like:

$ echo “hello, world”

If you copy paste that whole thing, the shell tells you it can’t recognize the $, so it should’ve been obvious to him after a minute but we went in a circle for a sec before I realized what was going on. My bad for assuming people knew what that meant, but he obviously had never used the command line before.

Seems unlikely to me that’s it a problem on your end. You can try to clear your browser cache to see if that fixes it.

Welcome to my world, trying to debug obscure issues :/ lots of dead ends before you find one post from like 2014 that has half the solution to the problem

What browser? Try a different one.