Joined July 2012
·

Otávio Cardoso

DTM
·
Brazil
·
·

Posted to bower: command not found over 1 year ago

@ray760 PATH is an environment variable that contains a list of directories where the shell search for executables. When the output for some command is "not found", it means that the shell did not find the executable for the command in anyone of the directories listed in PATH. This command add to PATH the directory where bower executable is.

More info: https://www.cs.purdue.edu/homes/cs348/unix_path.html

Sorry any engrish.

Posted to Array#extract_if over 1 year ago

@charly : I think #extract! is simpler, but it could make the same confusion that @deradon points, people expect that it is the same that #reject!, extracting all elements matched. And about the bang... Actually, this makes me think why #delete and his "brothers" does not have the bang.

And I agree with you. My solution is just for this "simplest" case, when you don't have to do any different treatment with the extracted link, you don't care about the ordering of the links but the first, etc.

Posted to Array#extract_if over 1 year ago

In the example, I used to do:

links.sort_by { |link| link.match(/wikipedia.com/) ? 0 : 1 }.join(' - ')

Of course, if I don't care to the order of the links as long as wikipedia appears first.
And I agree with deradon and oelmekki, I would call this method "extract_first!"

Achievements
1 Karma
0 Total ProTip Views