G33K-TRICKS

Sunday, April 15, 2018

Google Android P might have been named Popsicle


Android P was first released in March, but it’s still known as “Android P” . Google has not named it yet, But intrestingly, in recent Instagram post from Google, Google has released sets of new 5 wallpapers to their followers. (Yes, google do like Instagram and has 6.2M followers)
Here is the link to Google Instagram: https://www.instagram.com/google/

These wallpapers are more like other Google's fancy wallpaper but among them, one stands different from other . Hope this does ring bells. That could be a hint from Google about the name of next release.


Google P = Google Popsicle




Or Google is just being witty and trolling their followers :)

Interestingly, Google named it Pie

Monday, October 9, 2017

How to solve "Move`% s` out of conditional. " error.


[SOLVED] How to deal with "Move `% s` out of conditional." error from Rubocop.

Below is the problem statement.
Problem:
Move `% s` out of the conditional.

where %s is a Method name.
As the method call pointed out that %s is redundant, Rubocop throws this as an error.
What it means is that the method that is common under both condition should be moved outside the Conditions as it would be executed in either of case.
Below the simpler way to look at it and how to resolve it.
Solution:
@bad Code
if condition
  do_x
  do_z
else
  do_y
  do_z
end

@good Code
if condition
  do_x
else
  do_y
end
do_z