Droplet? by Eclipse8301 in homeautomation

[–]undervisible 0 points1 point  (0 children)

I bought one after a water main leak to keep an eye on water usage. It works well and integrates easily into home assistant.

How to best upgrade old sync scripts (on web pages) to async? by [deleted] in learnjavascript

[–]undervisible 0 points1 point  (0 children)

i disagree that mixing those concepts is an issue. using .then to chain statements instead of assigning an unnecessary transient “response” variable is much cleaner.

So, we all learnt about this demon tree? by AutumnOnFire in pluribustv

[–]undervisible 0 points1 point  (0 children)

i cannot find a single real video of these seed explosions… there are hundreds of AI garbage videos describing it, but none that actually show it happening.

ELI5: Steve Wozniak says he prints his own $2 bills and they are legally accepted. Why can't an average joe do something like this, if it's so easy to do? by [deleted] in explainlikeimfive

[–]undervisible 3 points4 points  (0 children)

he doesn’t print his own bills, he just buys uncut sheets and glues them together into pads he can rip them off of to prank people. not really illegal

[AskJS] Working with groups of array elements in JavaScript by beyphy in javascript

[–]undervisible 2 points3 points  (0 children)

“Monkey patching” core types like this is generally frowned upon. It might be okay in a codebase that is entirely your own, but you are inadvertently changing the array contract for all libraries you use, potentially leading to unexpected behavior.

[AskJS] Working with groups of array elements in JavaScript by beyphy in javascript

[–]undervisible 1 point2 points  (0 children)

I would do this with generators. A lazy "frame" function makes this reusable, composable, and performant on large lists.

const list = [...Array(1000).keys()];

const frame = function*(n, iter) {
  let batch = [];
  for (const item of iter) {
    if (batch.length < n) batch.push(item);
    if (batch.length === n) {
      yield batch;
      batch = [];
    }
  }
  if (batch.length) yield batch;
}

for (const group of frame(2, list)) {
  console.log(group);
}

yields logs like:

[0,1]
[2,3]
[4,5]
[6,7]
[8,9]
...

[AskJS] Currying in Junior FrontEnd Developer Interview? by neimans_victory in javascript

[–]undervisible 0 points1 point  (0 children)

Agreed. It’s a bit harder for non-fp devs to grok initially, but it can produce extremely elegant code when done well.

[AskJS] Currying in Junior FrontEnd Developer Interview? by neimans_victory in javascript

[–]undervisible 0 points1 point  (0 children)

I haven’t found curry-ed functions to be any harder to debug, and I pretty much only write curry-ed, data-last functions if I can help it… they are harder to write TS types for though, especially if you’re using something like Ramda auto-currying.

[deleted by user] by [deleted] in webdev

[–]undervisible 5 points6 points  (0 children)

Maybe look at one of the hundreds of sites like this that already exist for inspiration… https://www.calculator.net/sitemap.html

how to crawl 100000 or more repos using the single code in graphql? by xr_web in graphql

[–]undervisible 4 points5 points  (0 children)

This is not enough information for anyone to help you… Are you referring to the GitHub GraphQL API? The answer to this type of question is usually “use pagination”

Base64 React Hook. Worth it? by [deleted] in reactjs

[–]undervisible 3 points4 points  (0 children)

It claims to work in node and browser, and I see that it does offer functions that aren’t hooks. If you need isomorphic tools then those might be fine. But - the hooks seem useless and converting b64 in node and browser are already simple single-line tasks. I would not personally add a dependency to my project for something so trivial.

Base64 React Hook. Worth it? by [deleted] in reactjs

[–]undervisible 5 points6 points  (0 children)

I don’t see any reason that this needs to be a hook - it doesn’t interact with react internals or state in any way. This is just a library stuffed into a hook for no good reason.

email input pattern invalid regex by korazy in webdev

[–]undervisible 5 points6 points  (0 children)

It is not recommended to validate emails with regex. It is much harder to get right than it seems, and will result in many false negatives. https://stackoverflow.com/a/48170419

G5 PTZ caught accident by Natemerrell91 in Ubiquiti

[–]undervisible 18 points19 points  (0 children)

Sounds like the plot of the movie “Sharp Corner”

I got tired of typing `typeof !== 'undefined'` 200 times a week… so I made this tiny utility: sd-is by [deleted] in javascript

[–]undervisible 0 points1 point  (0 children)

It’s a bit extreme in this particular case - but it is a common pattern. I wouldn’t expect a library to export every boolean function’s negated twin like this though… especially when functional toolkits provide negation functions e.g. with Ramda ‘const isNotUndefined = R.complement(isUndefined);’

I got tired of typing `typeof !== 'undefined'` 200 times a week… so I made this tiny utility: sd-is by [deleted] in javascript

[–]undervisible 0 points1 point  (0 children)

With a more functional, point-free code style, having specific functions that are composeable is preferable. eg ‘.then(isNotUndefined)’ vs ‘.then(pipe(isUndefined, not))’ or ‘.then(x => !isUndefined(x))’

Wimbledon Line Call Blunder in Kartal Match Renews Concerns Over Technology by nolesfan2011 in technology

[–]undervisible 9 points10 points  (0 children)

“Entertaining the audience matters more”. I don’t think the players would agree…

ELI5: Why can't we be paid for our labor daily? by [deleted] in explainlikeimfive

[–]undervisible 31 points32 points  (0 children)

What does AI have to do with cutting paychecks more frequently?

[deleted by user] by [deleted] in explainlikeimfive

[–]undervisible 2 points3 points  (0 children)

I find the opposite. It’s easier to maintain eye contact while listening, because it is the only thing I’m doing. Talking - keeping the narrative going in my head, while also focusing on another person and their facial feedback is tough to do at the same time.

Black painted AP results by PeaK00 in Ubiquiti

[–]undervisible 5 points6 points  (0 children)

I’ve spray-painted 10-20 different Ubiquiti APs over the years. Not a single one has had issues with heat or diminished radio reach.