I wrote most of the 'fizzbuzz' function but couldn't remember the "%" operator. Tests are annoying because it's not how developers work, at least I don't work that way, without any way to verify syntax or look anything up.
I recall an interview from years ago where I was asked to show the code behind my websites and step through it explaining what it did and why I did it. This is better than a test, because you're explaining how the code works and also showing off your work.
It's all good, it wasn't the role for me, I'm more creative dev than programmer and I didn't get a good impression of the company anyway. I've moved on.
Later I moved that project to a github-organization, as it didn't need to be tied solely to me, and I wanted to allow others to commit, etc.
I'm not sure if the SPAM-mails went away because recruiters stopped scanning github for profiles, or because there was no obvious link between that particular project and my personal email.
Granted, this has been for gigs (or temp-to-perm) situations, not official, up-front fulltime roles. And some of these people ended up being flakey or sketchy (as spontaneous / whimsical people sometimes are). But nonetheless, hired (or substantially fast-tracked into their process, bypassing most of the usual interview crap) - pretty much on the basis of single demo or code sample (or in one case, literally on the basis of a single stats plot).
Because by this point, pretty much everyone knows how silly those live fizzbuzz sesions are anyway - including those administering them.