But a priori you don't know if the code you find on Github is "good", plus it doesn't come with a handy explanation. The quality of the data is much, much worse.
Fair point, but large, popular and well maintained/healthy repos would likely be better to learn from than SO. Lots of stack overflow convos have moved to GitHub issues as well.