" wonder if detonating a nuke on an asteroid would do anything other than create a huge electromagnetic pulse? There is nothing but high vacuum in space, so there is no medium to propagate a shock wave like we get when we set one off on earth. I've read that to maximize damage, nukes are detonated above ground, something like a few thousand feet. Other than melting some of the asteroid, I'm not sure it would do much else."
Just as a rocket works in a vaccum (for every action, there is an opposite reaction- one of Newton's Laws), so would a nuclear explosion. As space isn't a true vaccum (X number of Hydrogen atoms per cubic centimeter), energy and the ejecta from the explosion would cause a shock wave.
Using the Newton's Law noted above, one theoretical method of prevent an earth strike would be to change the trajectory of an object using nuclear weapons or rockets. At a far enough point from the Earth, a degree or so change in orbit could prevent that object from striking the Earth. The problem is getting to that asteroid. However, we do have the technology. We'd have to determine the mass and composition of the asteroid.
I'm sure that once the orbit of the object is confirmed, and the position of the Earth on 01 Feb 2019 is also confirmed, we can do something to change the trajectory of that object, if necessary