```
#!/usr/bin/env ruby
time_to_wait = ARGV[0].to_i
loop do
display_attached = `system_profiler SPDisplaysDataType | grep "Thunderbolt Display"`.chomp.length > 0
if display_attached
puts "#{Time.now} - Detected external display: instructing computer to not idle-sleep to avoid crashing, for #{time_to_wait} seconds"
`caffeinate -i -t #{time_to_wait}`
else
puts "#{Time.now} - No display detected. Sleeping for #{time_to_wait} seconds"
sleep time_to_wait
end
end
```
Hello! Using my first toot to link to my PR with a fix for an edge case in Rails that also fixes an old demeter violation. https://github.com/rails/rails/pull/43760
Ruby on Rails has released v. 7.0!!
This time I had the honor & privilege to contribute with 8 commits.
I'm so grateful for maintainers and contributors who #keepRailsRelevant
https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision
This past year I have been working on my spare time to build a web interface for Masto.host.
It's starting to come together and I expect in about a month to start running a closed beta test.
I have wrote more details here: https://masto.host/access-to-backups/
Any questions or suggestions please let me know.
This is all of the Ruby code you need:
#!/usr/bin/env ruby
require "http"
HTTP.auth("Bearer YourMastodonAccessTokenGoesHere")
.post("https://ruby.social/api/v1/statuses", :params => {:status => "You can toot to Mastodon using the HTTP gem in TWO lines. I'm doing it right now"})
I have turned on account moderation. I actually turned it on a few weeks ago, but then turned it off during #railsconf to make it easier for attendees to join.
However, less than a day later, an account appeared posting links which clearly broke the instance rules, so it's back to moderation again.
It's not actually that much trouble to approve the accounts, and it's vastly preferable to having to suspend abusive ones, so overall I think this was the right choice.
Anyway! Ruby!
I'm quite enjoying this year's remote version of #RailsConf - clever use of Discord gives a good sense of community even with most of the talks being pre-recorded.
Anyone else here "attending"? #rails
RT @therubygalaxy@twitter.com
Interested in speaking at Ruby Galaxy? Our CFP is now open!!Take a look at http://rubygalaxy.io 🛰
🐦🔗: https://twitter.com/therubygalaxy/status/1375518641714733059
Don't cache ActiveRecord objects: https://interblah.net/don-t-cache-activerecord-objects
Why did I never know this existed? It's so good.
Furthermore, it's recommended that you install cypress via npm, vendoring it in each project.
Got ten projects? Kiss 7GB of disk space goodbye.
I know that efficient disk space hasn't always been a top priority in the NPM world, but still, yeesh...
I'm a big believer in system tests, and I front-end developers I know really like Cypress, so this will be interesting to explore: https://gilesbowkett.com/blog/2020/10/09/cypress-rails-circle/
What's crazy about Cypress, though, is that the Cypress app is 704MB. That's one hell of a development dependency.
I agree with much of this article: https://www.rubypigeon.com/posts/my-beef-with-rubocop/
https://interblah.net/two-thoughts-about-maintainable-software - in which I take inspiration from @robbyrussell's latest podcast episode for a couple of thoughts about maintainable software
Loving Ruby since 2002. or 2001. I really ought to figure it out.
I’m the admin for this instance - if you have any questions or problems, let me know!