Regulating Intercalation of Layered Compounds for Electrochemical Energy Storage and Electrocatalysis