Better HN
topnewbestaskshowjobs
Log inSign up

hakunin

2,515 karma · joined Mar 4, 2010 (16y ago) · 549 submissions

https://max.engineer, mastodon:ruby.social/@maxim, x.com/hakunin, bsky.app/profile/max.engineer

meet.hn/city/43.1009031,-75.2326641/City-of-Utica

---

Submissions

comment 1y ago · link · parent

Here's my preferred approach, with breadcrumbs kept in erb views:

Make this view helper.

    def breadcrumb(&)
      render(layout: 'common/breadcrumb', &)
    end
Add this partial 'common/_breadcrumb.html.erb' (do whatever html you want):

    <li class="breadcrumb-item">
      <%= yield %>
    </li>
Add this to your layout:

    <% if content_for?(:breadcrumbs) %>
      <ol class="breadcrumbs">
        <%= yield :breadcrumbs %>
      </ol>
    <% else %>
Then this is how you use it in your views:

    <% content_for :breadcrumbs do %>
      <%= breadcrumb { link_to 'Foo', foo_url } %>
      <%= breadcrumb { link_to 'Bar', bar_url } %>
      <%= breadcrumb { 'you are here' } %>
    <% end %>
For minitest tests I add this helper:

    module AssertBreadcrumbs
      Crumb = Struct.new(:text, :href)

      # Note: the block must have 1 argument per breadcrumb. It asserts their count.
      def assert_breadcrumbs(&blk)
        assert_select '.breadcrumb-item', blk.parameters.size do |items|
          structs = items.map { |item|
            if (link = item.css('a')[0])
              Crumb.new(link.text, link['href'])
            else
              Crumb.new(item.text.strip)
            end
          }

          yield(*structs)
        end
      end
    end
Which you can use in tests like this:

    assert_breadcrumbs do |item1, item2, item3|
      assert_equal 'Foo', item1.text
      assert_equal foo_url, item1.href

      assert_equal 'Bar', item2.text
      assert_equal bar_url, item2.href

      assert_equal 'you are here', item3.text
      assert_nil item3.href
    end

comment 1y ago · link · parent

Nice deep dive. On a tangential point: nowadays Turbo Streams are less needed in Rails, because of the way Turbo automatically kicks in by default. And in most (not all) situations, backend doesn't really save much time returning a piece of a page vs a full page, since in most backends preparing data for response takes 10s of milliseconds. So might as well just stick with default, unless you know that you specifically need to serve some granular change. While learning this stuff, I wrote a little FAQ (where I was the frequent asker of questions) that clarifies some things: https://notes.max.engineer/turbo-8-faq

comment 1y ago · link · parent

I think I feel you. However, I think you have conceptually loaded "method" with more meaning. I think a less loaded way to think of the object/method is that the object is the first argument to the method that is called on it. So

    5.times { puts 'hi' }
is equivalent to

    times(5) { puts 'hi' }
which you could expand to

    my_function = -> { puts 'hi' } 
    repeat_times(5, &my_function)
And here is another reason for the disconnect: in a purely functional language repeating a function five times is useless, you're doing something for side effects only. Looping in itself is kind of a wrong (i.e. incomplete) abstraction for functional dev, because you're usually thinking in higher level concepts, such as `reduce`-based transformations. Maybe that's another part of the reason why `5.times { … }` feels off.

After my foray into functional programming, I actually ended up appreciating Ruby more, because it lets you have it both ways: program your computer directly, and harness functional concepts. Since computer hardware is not functional I don't want the extra ceremony and abstraction over it for the sake of purity.

All that said, going back and forth between Ruby and Elixir really conceptually crystallized for me that the method call receiver is basically just the first argument to the method, accessible with the keyword `self` (which in Python is made explicit for example).

comment 1y ago · link · parent

Everything I recently researched about display technologies, mini LED has no image retention/burn-in issues, and renders fonts better compared to OLED. It seems you want OLED for media (and mobile, since you often alternate entire screens), IPS for work, and mini LED as a more expensive compromise without burn-in, that does text as well as IPS, and media almost as well as OLED. I wonder why would they even want to use OLED on work screens with lots of static content, did something major change about the tech such that it doesn't suffer these issues anymore?

comment 1y ago · link · parent

I know it's weird, I'm a long time software guy myself, and would be surprised too if I didn't see this for myself. The thing about us is that our customers are banks. New banks are joining because they already know about us from the other banks. Our founders do the literal legwork of flying places and talking to people, establishing direct relationships, and talking on the phone. This is actually one of our strengths, we are not primarily a tech shop trying to sell tech to banks, but rather our founders are former bankers themselves who are trying to help solve their problems first, and sell tech as a side effect of that.

comment 1y ago · link · parent

I work with him at this company. We are still going, just don’t have much of a public facing side, because most of the sales are direct b2b. We’re working on showcasing more of what we do, but it hasn’t been our top priority.

comment 1y ago · link · parent

We tried different services like these, they quickly become unappetizing. You end up forcing yourself to microwave a box vs. order something fresh cooked.

comment 1y ago · link · parent

I need this for DoorDash desperately. My wife and I trying to figure out what to eat every day is one of the most annoying parts of the day. If anyone has any recommendations, would be much appreciated.

comment 1y ago · link · parent

For one, I don't think complexity is determinative of impact. At least I hope not, otherwise my startup ideas are all DOA. For two, Omarchy is becoming more complex as more maintainers come in to write way more automation. You can kind of foresee where this is going: an Arch wrapper slowly growing into effectively a separate OS that's pushing other software to accommodate its choices. (See getting chromium to support live theme reloading, trying to get Fortnight to support Linux, etc).

IOW, Ladybird has depth, Omarchy has breadth.

comment 1y ago · link · parent

This might sound bad, but having worked in a few different languages, I find it kind of cute how some parts of Go seem to promote simplicity while others are simply what the authors were used to growing up. Sometimes it frustrates me when I write Go, when I see a tradeoff due to the latter. But yeah. Languages tend to have a lot of subjectivity of their author in them. The more "strict" the language is, the more confined you are to the author's opinions.

comment 1y ago · link · parent

> I disagree that this is an accurate characterization of the side that isn't the "fringe far left".

The evidence is there. Trump has been thrashing back and forth on tariffs, explaining 2 mutually-exclusive reasons to have them, and they justify it each time. Trump has been infringing on free speech and due process at levels beyond anything democrats have ever done (if you don't count republican conspiracy theories), and they justify it. I have listened to a lot of debates, and nobody can answer a question "what would Trump do that would make me vote for democrats instead".

> Hasan Piker is getting to do another round

Again, these people are not voters.

> I am comparing media figures to media figures.

I'm sorry, I should've been clearer. You said "It was not a Republican media figure who made that video […]" and "it's not the right-wingers who are being shown to have all sorts of clips". I understood that as you making a point that democrats are worse than republicans in general because of these examples. Which cannot be true because the entire Trump cabinet and most republican lawmakers are now doing the most heated and divisive rhetoric constantly and unapologetically, as though they are influencers and agitators, not government of a 2-party nation. Their actions speak even louder than words. So what you're pointing out in totality pales in comparison to what republicans are doing. And I'm saying: you cannot point to leftie twitch streamers that don't have any political power, and compare them to the literal White House and republican lawmakers, to judge the magnitude of the problem on each side.

However, even if we single out just the media figures, it's absolutely insane how much conspiracy, lies, and divisive rhetoric has been fed into right wing minds. And it's almost awe-inspiring how lockstep all republican pundits are with each other. Nothing like that exists on the left.

comment 1y ago · link · parent

> Twitch

There are only 2 sides on twitch right now, both illiberal. One side has the political philosophy that amounts to "if Trump does it, we support it". The other side is a fringe far left (e.g. tankies).

Except the former "philosophy" is supported by 90% of republicans, and the latter is ostracized by democrats. Even AOC (the once symbol of far leftism) shifted towards more mainstream liberal democratic values. These twitch lefties don't vote. They are politically nowhere in this country.

And you are comparing president of the country to twitch streamers. President is not supposed to be an edgy instigator and influencer, he's supposed to be president for everyone.

And yet, every disavowal that Trump made, he ended up blaming democrats in the same breath. He constantly berates everyone on the left, sues, destroys politically, or otherwise silences anyone who criticizes him. I'm supposed to feel like he's my president even if I didn't vote for him, but I cannot, because he makes that distinction very clear.

comment 1y ago · link · parent

> - What Kimmel said was wrong (assuming you believe Utah state investigators) and deeply irresponsible and inflammatory.

I agree that we should be disavowing violence.

The problem is that for 10 years democratic lawmakers and media figures are disavowing violence on both sides, while republican lawmakers and media figures are doing the opposite: stoking the flames, promoting the idea of civil war, telling everyone that the country is stolen from them, that immigrants are out to get them, that democrats are out to get them, etc. According to this rhetoric, democrats are to blame for all of this. When something bad happens and it's not democrats who caused it, they come up with a conspiratorial explanation for how it's still democrats.

So when one side keeps constantly disavowing, and the other side keeps constantly attacking, at some point disavowing becomes literally the wrong thing to do. You can't lay down your weapon while the other person just keeps hitting, and expect the hitting to stop.

What we are being shown repeatedly by republicans is that violent, divisive rhetoric actually leads to electoral victories, and grants free license to become "president for one side only" and do whatever that side wants. If democrats continue to disavow and apologize, they will end up simply extinct. This is why some democrats stopped doing that.

comment 1y ago · link · parent

This is surprisingly on point for any (esp. backend/fullstack) web devs who have terminal and editor (2 separate windows) maximized side by side in MacOS, where it only natively supports 2 maximized windows at a time. I used to have terminal + editor in one space, and terminal + browser in another. And sometimes I would add another space with editor+browser, in case I was doing something more front-end oriented. Now I can have everything in one space on MacOS.

comment 1y ago · link · parent

To be fair, this is a short lived effect immediately after transition. Goes away in 2 minutes.

comment 1y ago · link · parent

I got a curved 5k2k lg display for games, and every time I switch to work monitor (5k regular flat lg), it feels like I'm looking at an old CRT that's bulging out at me. Such a strange sensation. I do like the curved display a lot however.

197.

Rails, Omarchy, Geo Proxy: Rails World Opening Keynote [video](youtube.com ↗)

2 points · by hakunin · 1y ago · discuss

comment 1y ago · link · parent

I guess the “hard work = gains” sentiment is showing something, but since it’s literally a misnomer on its face, and people take it way too literally, I think it doesn't show what many think it does.

I think the problem is that work changed too fast. This shift is much harder to navigate. A lot of 20th century career conveyer belts have been disrupted in the last 30 years. A lot of schools are still setting traditional expectations that no longer match reality. This is why people think their work doesn’t lead to gains: job requirements have been swapped from under US workers, and everyone is struggling to keep up. That said, opportunities are larger than ever, but we have to become more "entrepreneurial" again, perhaps more akin to the way we were during Industrial Revolution. Take that English major and use it to become an excellent YouTuber rather than a writer, type shit.

> In fact, I'd go so far as to say everything about capitalism trends towards pre-made paths.

How do you explain every new innovation? Cars during the time of horses? Twitter during the time of Facebook and MySpace, family medicine during the time of hospitalists and experts (fairly new field), Amazon during the times of Sears, framework laptop during the times of Apple, etc, etc. People don’t always know what they want, and America is incredibly well catered towards starting businesses (at least until a certain guy in a certain white building does permanent damage). Saying that we’re all constrained to market is very reductive. We are more empowered to find new ways to be useful than ever before. Doing economically unviable things has never been ok.

I just want to make it clear that very specifically “hard work means economic gains” is ridiculous on its face, and a lot of people take it literally, without the caveat that you have to do something useful.

comment 1y ago · link · parent

Funny you say that, I too am an immigrant to US. Your parents probably understood the above on an intuitive level. We immigrants think of it as "goes without saying" type thing.

> It doesnt work anymore

It never worked to just work hard. People in today's society want to part with more money than ever in all of history (to buy things and services), you just need to be a part of what they want to part with their money for.

comment 1y ago · link · parent

I was always curious, why would anyone believe that hard work leads to economic gains in the first place? That's like saying "flapping your hands very fast leads to building a house". Nothing about working hard has anything to do with economic gains. This has always felt to me like magical thinking: if I check certain boxes, I'm automatically entitled to "hard work funds" allocated to me. Like anything in capitalist market, the only thing that matters is what people want to pay for, and doing that for them. It's not even that important how "hard" you "work" doing it, but yes, the more you do of what people want, the more you'll probably get paid for it.

Part of the issue is that when you're young, the school really imposes lots of schoolwork on you, that you can't ignore. It's like school takes over your time, but none of the liability for whether the time will be well-spent. And at this point you don't have good foresight to know the difference.

The more general wisdom I think that should be learned early in life: you always make your own path. Schools are tools for getting there, but the buck stops with you. If you decide to accept a "pre-made path" given to you by a school, you still have to be the one researching whether it makes sense and signing off on it. Just like when you work with doctors, financial advisors, or other contractors, you have to be the project manager of your life's project. Cannot delegate this part. Not easy to learn early unfortunately, but at least start with the understanding that the only thing that matters for economic gains is doing what people want to pay for.

comment 1y ago · link · parent

Yeah, this does require a certain team culture building effort. Just starting cold without any expectation-setting might not be received well.

One "rule" I try to meta-promote is — working code is the first step, and a great foundation to then proceed to clear and maintainable code.

Another, is that code reviews are first-class citizens deserving mindfulness.

comment 1y ago · link · parent

Yeah, not easy, but it helps to build some rapport first, so people learn what you’re after. The way I tend to do that is by leaving a review comment with an example code snippet that makes me understand it better, and a question “what do you think about this version? I tried to clarify a few things here.”. + Explain what was clarified. I find the effort usually pays off.

comment 1y ago · link · parent

Agreed, I wrote more in depth about it a few years ago: https://max.engineer/maintainable-code

comment 1y ago · link · parent

I found this type of approach (where you try to meet subjective readability goals with objective/statistical metrics) to not produce clear code in practice. Instead, I suggest this one weird trick: if your colleagues are confused in code review, then rewrite and comment the code until they aren't confused anymore. Don't just explain it to them ad-hoc, make the code+comments become the explanation. There is no better linter than subjective reading by your colleagues. Nothing else works nearly as well. Optimize to your team's understanding, that's it. Somehow, this tends to keep working great even as the team changes.

comment 1y ago · link · parent

I grew to believe that feelings have hard-to-recognize rationales that can be explained if you dig deep enough. Very few people ever do however. Recognizing the rationale is a great skill to have in many circumstances where you give feedback, like code reviews for example. It's also a skill that makes you a better teacher.

comment 1y ago · link · parent

Not the commenter, but also had experience with making music and writing software. I think the same applies to any creative endeavor. It’s super hard to consume what you produce as “someone else” (I.e. read what you write, listen to what you compose with fresh perspective). Usually it takes time to forget and disassociate from your work, because you get too used to it while producing it. Coming back to it another day can work sometimes, but very quickly you’ll get used to it again. I think this is one of the most effective ways to achieve quality tasteful results in anything. If you can train yourself to read your own code with fresh eyes almost as soon as you write it, you’d be unlocking a powerful shortcut, a cheat code to life. It’ll make the biggest impact on your code’s (and any other creative work’s) quality. This is also why sometimes you can spend hours painstakingly trying to design something, and it comes out terrible, nobody likes it. And you can do something in 20 minutes just improvising your way through, and it comes out an elegant masterpiece. That’s because you never gave yourself time to “get used to” your work such that you couldn’t perceive the problems with it anymore. You maintained that fresh impatient perspective the entire time.

comment 1y ago · link · parent

This is anecdotal, but one thing I do when comparing languages and frameworks, is browse the most popular libraries on GitHub from that ecosystem, and see how much maintenance they're getting. I usually use the contributors graph, as well as review how/when issues are handled. Ruby projects seem to have the most contributors maintaining the "deepest" libraries of any ecosystem I've seen, consistently, for the longest time. In other ecosystems I keep seeing one guy trickle-maintain some massively popular (based on stars) project that fizzled out over time. You could argue that some of that is due to "completeness", but I keep seeing evidence to the contrary: still many unsolved issues, but the initial activity spike subsides down to a trickle. To me that's what represents the health of an ecosystem: not how many new projects are created, but rather how well supported existing projects are.

208.

Won't AI always need human backup?(max.engineer ↗)

2 points · by hakunin · 1y ago · discuss

comment 1y ago · link · parent

Maybe you're right today, but I'm making an argument against the AI "endgame", not its current iteration.

210.

Failover to Human Intelligence(max.engineer ↗)

6 points · by hakunin · 1y ago · 3 comments

1
678
19