I’m using Unity 5.4.1f1 and the version of the scripts from the “pt” branch of the Github project for this section. Well, actually, Unity auto-updated everything when importing it, so it might have modified the scripts in mechanical ways.
I have here the scripts annotated with my comments. Looking at the scripts is a spoiler for anyone who wants to figure them out themselves.
Rather than go back and edit the gists, I’ll mention one more thing here: by using AddTorque, if the ball is in the air and you use motion controls on it, it doesn’t change motion, but changes spin, which becomes motion when the ball lands and has friction. Kind of a neat effect, intuitive for a ball-roller-type game.