So here's an attempt at that web component I suggested yesterday: github.com/philnash/time-forma

I called it <time-formatter> (thanks @thorwebdev) because it formats times.

Please take a look and let me know if it looks at all useful (and if it will work).
---
RT @philnash
If I was going to publish a web component that could take a date time in any time zone and format it on a page in the users correct time zone what would I…
twitter.com/philnash/status/13

I always hear that VS Code is less buggy than Atom. I might believe it if VS Code wasn't refusing to open right now.

Does anyone else have a Rails controller to dynamically generate a service worker? Am I a monster?

Github is telling me that I contributed to the Arctic Code Vault. For the life of me, I have no idea what I did that's in there.

So Tim Burgan, developer at @github@twitter.com, lets you play ♟️ on his profile. Interaction is done by creating issues.

github.com/timburgan/timburgan

I guess you have to think outside the box sometimes.

Motivational speaker on YouTube: "Be the hardest worker in the room!"

Me, working alone from home: "I GOT THIS!"

My logs show decreased RPM (~120 - ~30), which makes sense since I replaced a polling operation with a persistent connection. The polling requests were pretty fast, so removing them as distinct requests also increased my average response time. Memory usage went up a noticeable amount, if not a ton.

Show thread

I found the docs somewhat confusing. I think a lot of it was because I was adding ActionCable to an app that hadn't had it, so there were some config settings that I had to change and some files I had to add. Seems like the docs are geared more towards a newly-generated app.

Show thread

Just set up ActionCable for the first time. My app is now officially RealTime™

This seems to indicate it was intended for public use. Maybe the guides never got updated?

github.com/rails/rails/pull/25

Show thread

Any Rails devs familiar with collection caching? I discovered I can:

<%= render partial: 'asdf', collection: some_things, cached: ->(one_thing) { [one_thing, local_var] } %>

This lets me cache based on values of local variables.

I can't find this documented anywhere, but this doesn't feel like one of those undocumented Rails features that isn't meant to be public. This isn't just an implementation detail, it's an alternative use someone implemented on purpose. Safe to use?

What can make the dependent: :nullify option fail with a ForeignKeyError on an ActiveRecord has_one relationship?

There are not two records referring to the same parent. The relationship works on a fresh app. It works in the tests. It works if I change the relationship to has_many. The code works in the debugger console that pops up in the browser when the same code raises an error within the controller action. WTF?

Enumerable#tally in Ruby 2.7 is cool, but I wish it took a block.

[1, 2, 3, 'string', 'str', CustomClass.new].tally(&:class)
=> {Integer=>3, String=>2, CustomClass=>1}

I saw some discussion for a :tally_by method to do this, but I don't see why :tally can't just take an optional block like :sum does.

I keep in my room a chunk of monocrystalline silicon with googley eyes on it just to remind me of the folly of teaching rocks to think

Today I upgraded a Rails app to Ruby 2.7.0 with no apparent issues. I was a little surprised at that, given the changes to keyword arguments, but the only warnings I saw appeared to be triggered by Rails itself, not by my app code, and they were just deprecation warnings.

Show more
Ruby.social

A Mastodon instance for Rubyists & friends