Alexey Zapparov
                                            Alexey Zapparov
                                        
                                    Oh. That's interesting. Although still a bit strange: ``` ruby class Memoizer VALUE = "xxx" def initialize @value = nil end def return3 return @value if defined?(@value) @value end end...
First of all, I want to emphasize that `||=` and `||` works ONLY if your memoized value is NON-falsey, so if your expensive computation returns `nil` or `false`, then `||=`...
Also, benchmarks are highly affected with `X.times`. So this is my small take on this benchmarks: ``` ruby require "benchmark/ips" class Memoizer VALUE = "some value".freeze CYCLES = 10_000 def...
`arr.reverse.sort` simply makes no sense. `Array#reverse` returns reverse-ordered copy of an array. Comparing `sort_by { |a| -a }` to `sort_by(&:-@)` was already covered in: https://github.com/JuanitoFatas/fast-ruby/blob/master/code/enumerable/sort-vs-sort_by.rb Comparing `sort { |a, b|...
I still think this comparison is weird and very niche - it has meaning only when the object is an `Array` of `Number`s. In which case the bet variant will...
@YamiOdymel Thank you sir! Would be awesome to be able avoid such hacks though IMO.
@franklinyu Empty string is not a valid body for [JSON](http://json.org/) indeed. Strictly speaking, `null` is not valid JSON either. Valid JSON must have either key/value collection (even empty one, e.g....
@franklinyu Take a look on responses description: - http://jsonapi.org/format/#crud-updating-relationship-responses-202 - http://jsonapi.org/format/#crud-updating-relationship-responses-204 More than that. You SHOULD NOT send body with 204 response according to HTTP specs as well.
Awesome! Thanks!
Sorry, missed notification. Will take a look this weekend.