Over the past few months I've occasionally had my calves threaten to cramp up on me while climbing. The hills I climb are typically 0.8-1.4mi long with an average grade of 5-7%, so I'm not really climbing mountains here.

They aren't full on cramps where the muscle fully contracts and I can't straighten my foot without serious pain, they are more like warning twitches where my muscle contracts for a half a second then releases, but it does it every second or so as I pedal while seated.
So far I've been able to fend these off by doing one of two things:
1. Straitening my foot in my pedal stroke, trying to keep the bottom of my foot parallel to the ground all the way around. This seems to keep the muscle stretched enough to prevent a full on cramp
2. Getting out of the saddle and pedaling for about 20 seconds or so. Not sure why this works other than changing the muscle recruitment based on the position. My toes are actually more pointed to the ground in this position than when I'm in the saddle. *shrug*
Are there other techniques to help fight off these types of warning cramps during climbs? Once I hit the top they almost always subside and if I have a mile or more of flat or descent before the next climb, they usually don't return.