Convolutional Neural Network Example in Tensorflow
Your calculation would be correct if the example were following the "usual" approach of having convolution chop off the edges.

Instead the example you pointed to says:


  How do we handle the boundaries? What is our stride size? In this example, we're always going to choose the vanilla version. Our convolutions uses a stride of one and are zero padded so that the output is the same size as the input.


So they are:


zero-padding the 28x28x1 image to 32x32x1
applying 5x5x32 convolution to get 28x28x32
max-pooling down to 14x14x32
zero-padding the 14x14x32 to 18x18x32
applying 5x5x32x64 convolution to get 14x14x64
max-pooling down to 7x7x64.


They probably have an option to turn the zero padding off.  In other infrastructures I've used zero padding is not the default.  (In several of the infrastructures I've used zero-padding isn't even possible.)