A generalization of Geraghty's theorem in partially ordered metric spaces and applications to ordinary differential equations