Run EXPLAIN ANALYZE on an ActiveRecord query if you use Postgres:

puts ActiveRecord::Base.connection.execute("explain analyze #{your_query.to_sql}").values

Not Ruby-specific, but this is an interesting long read about the evolution of Uber's tech stacks:

stackshare.io/stack-history-ti

Here's a no-fuss way to mock `rand` in your specs:

allow_any_instance_of(Object).to receive(:rand).and_return(5)

Is there any reason to use minitest now that it's not even part of the Ruby Standard library any more?

If you have to pull a gem, you might as well just pull RSpec.

Foreman start alias:

fs() {
local options=''
if [ -e '.env' ]; then; options='-e .env'; fi
if [ -e '.env.local' ]; then; options="$options,.env.local"; fi
if [ -e 'Procfile.dev' ]; then; options="$options -f Procfile.dev"; fi
eval "foreman start $options $@"
}

I think it would take a lot of resolve to make GraphQL resolvers resolve all of the world's problems.

@timcase Thanks for the tip. My ~/.gemrc had `--no-ri --no-rdoc` but it was ignored and I didn't noticed that docs were still installed! `--no-document` fixes it.

@sfcgeorge I also hate it when middle-managers say "If you don't do this you're not a team player!".

You could justify all sorts of very wrong evils with this sentence. πŸ˜‚

@james Very interesting idea... πŸ€” Even more powerful would be to also runs tests for any non-test files changed since master. Assuming that your test <-> non-test directory structure is predictable.

(too lazy to write the right bash to do that though 😁)

Automatically resolve Git merge conflicts in Rails schema.rb:

gist.github.com/jeromedalbert/

(I have also updated tpope's hooker gem to reflect Rails 5.x changes)

My weekly newsletter backlog is starting to pile up. 2 Stackshare, 2 Ruby Weekly, 2 Dev, and a few other ones. I am contemplating them in my Gmail folder but not opening them yet as I have shit to do.

Oh and of course I have a 150 items RSS backlog. Sigh.

ObjectSpace.memsize_of(Object.new) == ObjectSpace.memsize_of({})

Cool.

@phaedryx You know you're an adult when things like new code loaders make you excited! 😁Jk, sounds very interesting, especially if this fixes common Rails wonky (auto)(re)loading problems.

Show older
Ruby.social

A Mastodon instance for Rubyists & friends