How a Republican Mayor turned his struggling California city into a clean energy powerhouse