I’ve been putting together a list of my favorite movies, books, games, and other stuff (just for fun!). Added links to all the things tonight.

So proud to see my better half graduate this weekend! And somehow she did it all while being a super-mom of 2!

Stack Overflow for Teams looks amazing! I have a hunch this will be the tool that finally solves the “institutional knowledge” problem.

Caught the kids playing together earlier this morning. It was an awesome little moment.

Playing Causality tonight — it gets my 👍! The time-puzzles are fun, and I really like the vibrant colors.

The new “smart resume” feature in Overcast 4.1 is really nice! Used it with Waze’s turn-by-turn directions the other day and it worked great.

Had so much fun with PikoPixel last night, I drew this little ninja guy tonight. Hoping to try some animations soon.

Tinkered around a bit with PikoPixel tonight! I’m not much of an artist, but I still had fun drawing these cubes.

Houston Rodeo 2018

Last week we took the family down to Houston for the annual rodeo. Tons of BBQ, animals, crafts, and good times all around!

See Ruby Source Code Inside Pry

I learned something new about the pry tool today, after reading this post from John Mair (the creator of pry).

You can use the show-method command to lookup the source code to Ruby’s standard library methods:

[1] pry(main)> require 'uri'
[2] pry(main)> show-method URI::HTTP#request_uri

From: /Users/stevenschobert/.asdf/installs/ruby/2.4.2/lib/ruby/2.4.0/uri/http.rb @ line 102:
Owner: URI::HTTP
Visibility: public
Number of lines: 6

def request_uri
  return unless @path

  url = @query ? "#@path?#@query" : @path.dup
  url.start_with?(?/.freeze) ? url : ?/ + url
end

This also works for methods implemented in C:

[3] pry(main)> show-method String#chomp

From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 7

static VALUE
rb_str_chomp(int argc, VALUE *argv, VALUE str)
{
    VALUE rs = chomp_rs(argc, argv);
    if (NIL_P(rs)) return rb_str_dup(str);
    return rb_str_subseq(str, 0, chompped_length(str, rs));
}

In the example above, it’s hard to get a good idea of what String#chomp is doing, because most of the work happens in the chomp_rs function. Thanks to a recent addition, you can now lookup these functions in Pry as well:

[4] pry(main)> show-source chomp_rs

From: /Users/stevenschobert/.pry.d/ruby-2_4_2/string.c @ line 8122:
Number of implementations: 1
Number of lines:  13

static VALUE
chomp_rs(int argc, const VALUE *argv)
{
    rb_check_arity(argc, 0, 1);
    if (argc > 0) {
        VALUE rs = argv[0];
        if (!NIL_P(rs)) StringValue(rs);
        return rs;
    }
    else {
        return rb_rs;
    }
}

Another handy command is the show-doc command, which will show documentation for the method:

[5] pry(main)> show-doc Time.now

From: time.c (C Method):
Owner: #<Class:Time>
Visibility: public
Signature: now()
Number of lines: 4

Creates a new Time object for the current time.
This is same as Time.new without arguments.

  Time.now #=> 2009-06-24 12:39:54 +0900

Note: Both the show-doc and show-method commands require the have pry-doc add-on gem installed:

gem install pry-doc

I’m a heavy Dash user, so I typically use that to lookup docs/source code when working in Ruby. But having access to them in pry is definitely going to come in handy for cases when I don’t have direct access to Dash. Dash also can’t lookup the internal C methods like chomp_rs like Pry now can.

UPDATE: I had originally written that the C support to the show-method command was new until John Mair kindly corrected me. What’s new is seeing C functions that don’t directly map to Ruby methods, like chomp_rs.

Lookin’ out at the world 😎

This is one my test shots using Focos Camera on the iPhone X. They don’t always turn out great, but I’m really liking what I can do with it!

Decided I’m going all-in with a hosted Micro.blog site and retiring my old site. I really love building everything myself, but I always end up tinkering with code instead of writing.