2,515 karma · joined Mar 4, 2010 (16y ago) · 549 submissions
meet.hn/city/43.1009031,-75.2326641/City-of-Utica
---
comment 1y ago · link · parent
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
endcomment 1y ago · link · parent
comment 1y ago · link · parent
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
comment 1y ago · link · parent
comment 1y ago · link · parent
IOW, Ladybird has depth, Omarchy has breadth.
comment 1y ago · link · parent
comment 1y ago · link · parent
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
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
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
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 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
> 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
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
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
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
208.
Won't AI always need human backup?(max.engineer ↗)
2 points · by hakunin · 1y ago · discuss
210.
Failover to Human Intelligence(max.engineer ↗)
6 points · by hakunin · 1y ago · 3 comments