
Ruby Tricks - franzunix
https://github.com/franzejr/ruby-tricks
======
code_sterling
A brief explanation of what some of these are doing, or moreover, a use case
for why I would want to use them would be handy.

~~~
sdegutis
Only looked at "Fetch Data" and "Bubbling up thread errors" so far, but they
were self-explanatory. I'm betting most of them are like this.

~~~
franzunix
Yeah..Some of them are self-explanatory, it makes me to think that the
comments/description may not be necessary. But, a simple comment it's not a
problem...Let's see. =)

------
stewbrew
I was hoping for something like "static code analysis" and "make code more
robust", not for "magic" and "even more magic".

~~~
zeendo
$VERBOSE is mentioned for warnings. That's pretty handy.

~~~
franzunix
I also like $DEBUG! =)

if $DEBUG p "var is %p" % var end

------
fphilipe
One very obscure trick in ruby is the flip-flop operator. Never used it and I
probably never will. There's an open issue to get rid of it[1]. Has anyone
ever had a real use case for it?

[1]: [https://bugs.ruby-lang.org/issues/5400](https://bugs.ruby-
lang.org/issues/5400)

~~~
mwpmaybe
You've never wanted a range of lines out of a file? It's a common Perl idiom.

~~~
lectrick
It looks like this is not being treated as a range operator, but a flip-flop
operator I've never heard of

~~~
mwpmaybe
That's the name of the operator, sure. One of the use cases of the flip-flop
operator is selecting a range of lines in a file.

------
sivers
Thanks for sharing this. Love this format. Learned about PStore, cycle, take,
fetch, securerandom, and more. May add to it.

Tweeted:

[https://twitter.com/sivers/status/660875966466514944](https://twitter.com/sivers/status/660875966466514944)

~~~
franzunix
thanks!

------
goofed
Awesome initiative! Already sent my PR :)

~~~
franzunix
thanks, goofed

------
buzzdenver
Sent a PR with a couple of fixes.

~~~
franzunix
thanks, man!

