I usually stop and yell "NO!" in the deepest, most intimidating voice I can find. When there's not something to chase, they nearly always stop (especially the vocal ones).
I've only actually had to get off my bike once for a dog that was still coming. I kept the bike between him and me while charging straight at him. He turned and barked over his shoulder as he went back to his yard.