News for hackers. Stuff that matters.

irjoe

Re:My Feed, My Way on Tuesday September 08, 2026 @07:20AM (#49608762)
I would say it's pretty common to talk to strangers on the train in England. I could just be the "Northerner terrifying Londoners by saying Hello" though. I do know not to start a conversation with a stranger on the tube.
Re:An Honest Review of Go (2025) on Thursday January 08, 2026 @12:24PM (#46543688)
I always felt like go channels were more of a clever solution than a good one. Goroutines are a pleasure to work with though.
Re:Introducing command And commandfor In HTML on Friday March 07, 2025 @05:04PM (#43295267)
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.
Re:Try thinking and learning without working memory (2008) on Wednesday February 19, 2025 @05:52AM (#43100764)
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.

I imagine the red blood was very noticeable on the white snow. I might be wrong though.
Re:Who Killed the World? on Thursday July 18, 2024 @06:45AM (#40994328)
I assume you're referring to Kowloon Walled City?
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.
Re:Shell Scripting with Elixir on Tuesday February 13, 2024 @05:02AM (#39356170)
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
Re:Requirements on Sunday May 28, 2023 @08:59AM (#36103615)
Would Be Nice Ifs, maybe?
Re:It's Time to Stop Texting on Wednesday January 11, 2023 @03:20PM (#34344061)
It was already fairly popular in the UK prior to being acquired by Facebook.
I live in a smaller city in the UK so my experience is likely much different from those living in larger cities.

I never wear a helmet when riding a bike and used to commute daily. I've never had an accident involving traffic and have come off my bike less than a handful of times commuting. It seems like the odds of me coming off my bike and hitting my head is very low.

I'm not averse to helmets I just don't think wearing one makes sense for my commute. I'd rather wear a woolen hat. I do wear a helmet when I go rock climbing and would probably wear one if I was commuting in London.

curmudgeon
Re:Emacs 29 on Tuesday November 29, 2022 @11:40AM (#33789770)
> 2. Any advice about automatic whitespace/indentation handling with Emacs?

I use prettier-mode and editorconfig-mode. Everything is formatted on save so works well for me.

There's an inherent difficulty in making difficult things easy. I think we're more likely to improve the ergonomics of writing software rather than make it easier for others to translate business logic into code.

I like to think that making software easier to write will just free up more capital to be spent on other software problems. I haven't seen many software projects where the client doesn't compromise features due to budget or time.

Re:Where in the HypeCycle is GraphQL? on Tuesday July 13, 2021 @11:24AM (#27822096)
I really wish the GraphQL alias syntax supported something like:

  query {
    users {
      email: contact.email
    }
  }
Re:On Repl-Driven Programming on Sunday January 03, 2021 @12:17PM (#25623117)
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.

Re:On Repl-Driven Programming on Sunday January 03, 2021 @12:02PM (#25622990)
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.

Re:Deploying front-end websites to S3 with CloudFront on Saturday February 15, 2020 @04:42PM (#22338193)
I've found a fairly workable solution is to have an origin for the API in CloudFront and a behaviour to route /api/* to that origin. Saves any CORS headaches. Obviously this won't work in all cases.
Re:Programming Patterns I Like on Sunday June 30, 2019 @05:19AM (#20317225)
Quite the opposite :) My preference would be to rely on pattern matching (unification) in the function head:

    def transform_data([_|[]]) do: []
I just wanted an example of using guard clauses. It does depend on the actual code though, there's probably a more elixiry solution.
Re:Programming Patterns I Like on Saturday June 29, 2019 @09:36AM (#20312489)
You're right, they're not really "early returns" but for me at least they are often in similar fashion to the "early exit" pattern in the article:

    def transform_data(raw_data) when length(raw_data) == 1, do: []
    def transform_data(raw_data) do
        # actual function code goes here
    end
That said, I wouldn't want to see the above snippet in my team's codebase :)
Re:Programming Patterns I Like on Saturday June 29, 2019 @03:44AM (#20311337)
I'm currently writing a lot of Elixir where early returns are a feature of the language (https://hexdocs.pm/elixir/Kernel.html#module-guards).

I also write a lot of JS and tend to use guard clauses fairly liberally. I find they make boundaries (x < 0) much clearer. My functions are also < 10 lines in most cases. For me it leads to less convoluted code but YMMV.