Categories
Development

Ruby is Wild

Ruby sometimes feels like the grumpy parent that gives in to a child’s demands, after they’ve thrown a tantrum. In this case the child represents us, programmers.

Though if you look at it more carefully, you’ll find that, in fact, Ruby is a language that respects the programmer. That explains why there are so many things you can do, which you can’t do in many other languages.

While not the most fascinating tidbit, I found the following quite interesting:

class Bonkers
  def go_wild
    def wilder
      def i_said_wilder!
        'okay'
      end  
    end  
  end  
end

Interestingly, all methods above are defined for the Bonkers class. So if you instantiate an object of this class, you’ll have all three methods at your disposal to call.

[1] pry(main)> class Bonkers
  def go_wild
    def wilder
      def i_said_wilder!
        'okay'
      end  
    end  
  end  
=> :go_wild
[2] pry(main)> o = Bonkers.new
=> #<Bonkers:0x000000014c2c3e20>
[3] pry(main)> o.go_wild
=> :wilder
[4] pry(main)> o.wilder
=> :i_said_wilder!
[5] pry(main)> o.i_said_wilder!
=> "okay"
Categories
Development

Reclaiming Some CPU Cycles From Apple

There I was, on a cloudy Saturday, working on a command-line tool for fun and no profit. As I went through the compile and run cycles, I became more and more frustrated at the time it took to run the newly compiled binary. This issue is also described in a post I ran into some time ago, which goes into the pains inflicted by Apple’s notarization “feature”.

Anyway, I could no longer take it. That second it took to actually start executing my binary, felt like an eternity. The solution? Open System Preferences, then go into Security & Privacy, switch to the Privacy tab, and then scroll down the list until you find Developer Tools. Add Terminal to the list of allowed apps, or toggle its checkbox if it’s already there, and voilĂ ! No more delays!