G33K-TRICKS - Your source to Tips and Tricks

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.


Problem:

Move `% s` out of the conditional.

where %s is a Method 

As the method call pointed out at %s is redundant, Rubocop throws this as error. The method that is common under both condition should be moved outside the Conditions as it would be executed in either of case.
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 

Saturday, May 6, 2017

Inception with Firefox Browser



I am sure you must have seen the movie Inception by Christopher Nolan. The movie is based on a wild theory of dreaming inside a dream. Though we cannot dream with Firefox but the trick is opening a browser inside Firefox. Yes, you can open a new browser tab in the browser tab. That sounds confusing as the movie was.
Here is a screenshot to simplify your thought.

Firefox Inception


This is what you need to do

Open Firefox
Type chrome://browser/content/browser.xul  in the address bar and press Enter
Baam! Inception

P.S.: Think, how did I get the screenshot of the webpage in this webpage while creating this webpage.

Check Out the Latest Posts

Recent Posts Widget