Quantum phase transitions in holographic models of magnetism and superconductors