My best tip is to carry a decent toolkit... it won't save you from every JRA but in many cases will get you home without having to do the walk of shame.
Besides the obvious multi tool, small adjustable spanner, and tyre repair goods I always have a number of zip ties, a few spare chain links to match the bike, quick link, a few small bolts and nuts, and material to boot a tyre if needed.