Welcome...



...All those moments will be lost in time, like tears in rain....

- soliloquy from Blade Runner


Bits and bytes do get lost, awash in the rain of data flow that is Internet. They slip away from us, never to found again... some of them will be captured here, many more will not... like tears in rain...



Monday, October 29, 2018

Ruby: blank vs empty vs any vs nil vs...

Sometimes having too many good things is not really good for you. So many ways to test for existence of the object or array that it's confusing.

Here is a short version:

- nil?
 Works on any object and checks is it nil or not.
 It returns true only for nil value.

- empty?
 It does work on strings, hashes and arrays, and enumerators in general.
 It returns true if there are not elements in the array.
 It does not handle nil values, you have to check is object is nil and is object is empty.

 a.nil? && a.empty?

 - blank?
 It is Rails construct, not part of Ruby.
 It is a shortcut for false, empty of whitespace string.

- present?
Opposite of blank, part of Rails framework.

- any?
 It works on arrays, hashes and sets.
 It checks is there is anything in the collection that can evaluate to true?
 It returns true if array has no elements except when it has nil values only.

Thursday, October 18, 2018

After a long time....

  It's been very busy year. I've changed the stack and now I am working in Ruby/Rails/ReactJS world.
 To say that things are different is understatement! From working on Mac to using whole new ecosystem of tools and acronyms to feeling of being a noob ... It's not being easy!
 However, light is starting to shine from the end of the tunnel and I do feel better, enough to start thinking about my blog again. There is evens that I can start sharing again, so let's go back to having fun while learning again!