HackerTrans
TopNewTrendsCommentsPastAskShowJobs

irjoe

no profile record

Submissions

Internet Archive Service Availability

archive.org
5 points·by irjoe·2 tahun yang lalu·0 comments

comments

irjoe
·6 bulan yang lalu·discuss
I always felt like go channels were more of a clever solution than a good one. Goroutines are a pleasure to work with though.
irjoe
·tahun lalu·discuss
Using document.addEventListener means it will work even if the DOM is updated without having to add new event listeners. If I'm not expecting the DOM to change I would be more inclined to do something like:

  document.querySelectorAll('.menu-wrapper')).forEach(menuWrapper => {
    const button = menuWrapper.querySelector('.menu-opener');
    const content = menuWrapper.querySelector('.menu-content');

    if (!content || !button) {
      return;
    }

    button.addEventListener(() => {
      button.setAttribute('aria-expanded', 'true');
      menu.showPopover();
    });

    content.addEventListener('toggle', e => {
      // reset back to aria-expanded=false on close
      if (e.newState == 'closed') {
        button.setAttribute('aria-expanded', 'false');
      }
    });
  });
The React example seems a little odd as well, if the "open" callback actually called "showPopover()" instead of only calling "setIsOpen" then the "useEffect" could be entirely redundant. The resulting code would be a lot clearer imo.
irjoe
·tahun lalu·discuss
I don't recall the exact numbers but I had a very similar experience, scoring very highly on spatial reasoning almost to the detriment of everything else.

I remember a close friend getting frustrated administering a working memory test on me. She couldn't believe how far removed from the norm my working memory capacity was given everything else she knew about me.
irjoe
·tahun lalu·discuss
I imagine the red blood was very noticeable on the white snow. I might be wrong though.
irjoe
·2 tahun yang lalu·discuss
I assume you're referring to Kowloon Walled City?
irjoe
·2 tahun yang lalu·discuss
I'm not sure that's entirely true in the UK. The Polish plumber taking British jobs is a fairly common trope in far-right discourse. I believe this is prevalent across Western Europe in general.
irjoe
·2 tahun yang lalu·discuss
You can also use anonymous functions if you find the module syntax a little terse or clunky for shell scripting.

    double = fn a -> add.(a, a) end
    double.(4)
It starts to look a bit like a weird untyped OCaml / F# if you use pattern matching:

    f = fn
      x, y when x > 0 -> x + y
      x, y -> x * y
    end
irjoe
·6 tahun yang lalu·discuss
Interesting. I do the same thing in Elixir where I'll attach an iex session to a Phoenix application so I can interrogate modules and APIs as I'm building them out.

I'm slightly disappointed that it's already something I do day to day. I had hoped that the power of the REPL wasn't overstated.
irjoe
·6 tahun yang lalu·discuss
Is there a simple way to get code I write in a lisp REPL back into my editor? That's the part missing for me and why I usually only use interactive shells (REPL or otherwise) for testing APIs or small pieces of code.

I can't imagine writing a program in its entirety in a REPL.