Best thing to do when a dog is coming at you and you can't out run him is to simply stop, don't swerve, just stop and the majority of the time he'll stop, if he doesn't then you just kick the sh*t out of him, which is much easier to do when stopped than riding the bike.
Of all the times/accidents I've been in I only had one in which it happend so fast that I didn't have time to think; one second I was on my bike the next I was in the middle of the road with a car coming directly at me at 55 mph, luckily, some how instincts took over and I, without thinking, jumped up, grabbed my bike and got out of the road. It was one of those times in your life when you ask yourself, "What just happened?"
How it happened: I was cruising along at ~20mph when I inadvertently drifted off the road, I immediately swerved to get back on the road, but at that speed and the narrow angle I hit it (the road's lip) that was enough to catapult my from the side of the road, directly into the center of the two-lane country road.
The "lip" on the edge of the road that caused this, dropped down at about a 70 degree angle and was probably only a couple inches high, but at that speed that was all it took to stop my bike, but I kept going.
This was over 20 years ago when I first started cycling, but even to this day when I look at the edge of the road I think of that experience. My first real lesson in how to ride a bike