Show newer

Am I even developing in Ruby any more?

items.each_cons(2).with_index do |(previous_item, current_item), i|

Setting macOS App Shortcuts on the command line for your setup scripts:

defaults write com.apple .preview NSUserKeyEquivalents \
'{ "Adjust Size..." = "@~s"; "Hide Sidebar" = "@1"; Thumbnails = "@2"; }'

Did you know that

User.where(id: [])

actually performs a useless ActiveRecord query?

For more nice tidbits, I recommend watching "Cache is King: Get the Most Bang for Your Buck From Ruby" when it gets processed in confreaks.tv/events/rubyconf20

I thought I knew mostly everything about Vim, but today I was proven wrong:

:set wrap!

will toggle between wrap and nowrap (or whatever option you set)

Mastodon 2.6 is out and running on this instance. ๐Ÿ‘

I have added the following to verify my website head:

<link href="ruby.social/@jeromedalbert" rel="me">

In order to get this vanity green verification mark:

TIL

50_000.times { |i| $redis.incr("abc:#{i}") }
# => about 8 seconds

$redis.pipelined do
50_000.times { |i| $redis.incr("abc:#{i}") }
end
# => about 0.9 seconds

Convert a string to ASCII and remove any resulting awkward spaces:

s.encode('ASCII', invalid: :replace, undef: :replace, replace: '').squeeze(' ').strip

Aphex Twin put all his music on his website for people to listen for free: aphextwin.warp.net

Happy coding

Latest version of Ruby is 2.5.1...
Latest version of Rails is 5.2.1...
Coincidence?

The Illuminati exist! This is proof!

Upgrading an app to Rails 5.2. New schema version formatting will make conflicts easier to read and resolve. *Tears of joy*

The Illustrated Children's Guide to Kubernetes, aka "get your Kubernetes Official Certificationโ„ข in 8 minutes": youtube.com/watch?v=4ht22ReBjn

I โ™ฅ๏ธ the Insomnia client. It's like Postman, but it also works for GraphQL.

stackshare.io/insomnia-rest-cl

Just bought tickets to my first . Excited! See you in 1 month in LA. โœˆ๏ธโ˜€๏ธ :ruby:

Turn children into orphans:

"๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ".chars.last(3).join

# => "๐Ÿ‘งโ€๐Ÿ‘ฆ"

Whenever I create a migration in Rails, this is what I use to run it:

alias mi='rake db:migrate db:rollback && rake db:migrate && RAILS_ENV=test rake db:migrate'

Ensures that your migration is reversible + migrates your dev and test DB in one go

Show older
Ruby.social

A Mastodon instance for Rubyists & friends