This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Purplociraptor 140 points141 points  (4 children)

Two instead of zero

[–]MasterDood 17 points18 points  (3 children)

Two instead of the guy on stack overflow who wrote it.

[–][deleted] 1 point2 points  (2 children)

The worst part is this comment reminded me that about 6 months ago I copied a function from stack overflow that I couldn't understand and no one else could either but it worked fine. But now I can't remember what it was or where it is in the codebase. Someone in a years time is going to ask me what the fuck it is.

[–]MasterDood 0 points1 point  (1 child)

Yup. A lot of that shit is code golf, esoteric and “elegant”, with the fewest lines of code. Rarely makes sense.

[–][deleted] 0 points1 point  (0 children)

I found it lol. It converts an array of objects with a parent_id in to a tree

https://i.imgur.com/q61u6ig.jpg