React.js and software workarounds

The amount of conceptual compromises React.js either addresses or introduces is very high. That, however, is typical, especially in a browser environment.

This introductory talk explains the basic design decisions that led to React.js.

Although the video is a bit old, it’s also surprising to hear, at the very end of the video, that the presenter has no idea whether React will be used for Facebook mobile on browsers. Reminds us of Microsoft.

Ruby on Rails: Array method From

Looking at RoR 5.0 beta’s source code, here’s a very simple method that has been around for a while and does what the framework is so great at: humanizing the programming interface.

/activesupport/lib/active_support/core_ext/array/access.rb@from

 # Returns the tail of the array from +position+.
 #
 # %w( a b c d ).from(0) # => ["a", "b", "c", "d"]
 # %w( a b c d ).from(2) # => ["c", "d"]
 # %w( a b c d ).from(10) # => []
 # %w().from(0) # => []
 # %w( a b c d ).from(-2) # => ["c", "d"]
 # %w( a b c ).from(-10) # => []
 def from(position)
   self[position, length] || []
 end

It’s an array method, so it will use the dot-chained array as self as is the case in Ruby.

It uses the already pretty convenient array[new_start, new_end] notation to chop off the beginning of the array.

If you are working on an array that has, say, 5 elements, but passed it a position value of 8, the above operation will mercifully not throw an exception – rather, it will just return nil.

In those cases the || [] ensures the method will still return an array type, in this case an empty one, which is a sweet spot between making sense and being convenient.

Studying Equities

The financial crisis of 2007-09 was quite unforgettable. It became easy to see the connections between Wall Street and people’s livelihoods half a world apart.

Up until then, I had taken no interest in stocks or bonds. I had no money, and the investing industry seemed to me like a casino for people who cared for nothing more than piling up money, if all went well.

Well, things were going terribly, but in the middle of all that wreckage you’d hear about one man swimming against the tide while being hailed as some kind of savior. That man was Warren Buffett.

My curiosity was aroused, so I proceeded to read up on the guy. It didn’t happen overnight, but it’s fair to say he opened a vast new mental latticework for me.

Although there’s much I could write on his philosophy, this time I’ll stick with a slice of a rule of thumb we can find in the writings of Buffett’s teacher Ben Graham: when looking for companies unburdened by debt, favor the ones with a ratio between debt and net equity of less than 0.5.

It makes sense: if all a man has amassed his whole life is $100,000 but he owes $85,000 to the bank – a ratio of 0.85 –, it will likely be a long while before he’s paid his debt down and is able to comfortably grow his net worth.

So I took to looking at these numbers from several quasi-randomly chosen companies listed on the Brazilian Stock Exchange, over 10 years for each issue whenever possible.

There are many details regarding criteria for picking the right balance sheet lines to yield the total debt I don’t yet fully grasp. This spreadsheet is where I compile the numbers.