Are there any good ways to prevent shin splints before it happens?

Proper training. Properly train and gradually build up your mileage or activity. Make sure your shoes are supportive, cushioning, and in good condition. If you are a runner, avoid running on hard surfaces. If you still have pain, talk to your doctor about custom orthotics.
Gradual increase. A gradual increase in your running program (no more than 10% per week). Adequate warm up and stretching before running. Appropriate running shoes for the shape/type and size of your foot.