Small performance tweak for Posts ordering.

* Move publishedAtCompare to standalone function in closure scope
  (allows better browser optimizations).
* Avoid getting the same field (published_at) more than once.
Merge pull request #3574 from rwjblue/speed-up-posts-orderby

Small performance tweak for Posts ordering.