I can't tell from the photograph; it is dark, and some of the wires are behind other wires. As long as the resistor is in series with the output wire of the distance sensor, it is placed correctly. If there's something I'm saying you don't understand, or not sure about, ask me.
The code you referred to is for a distance sensor mounted on a servo connected to an MCP3008, not an MCP3002. To use it you might have to understand each of the meaningful differences between the MCP3008 datasheet and the MCP3002 datasheet. It's a big job. It is better to stick with code for the MCP3002.
You might also try writing the code directly, using the
spidev module. You can do this interactively, at the Python interpreter prompt, until you've understood what is needed to get the data. For example;
>>> from spidev import SpiDev
>>> spi = SpiDev()
>>> bytes = spi.xfer2([128, 0])
>>> print bytes
Also, remember that the ADC gives you a number that is related to the voltage it receives, and the sensor gives a voltage that is related to the distance to the object. The MCP3008 code in
distance.py shows the author calibrated their sensor and ADC combination using mathematical curve fitting. That calibration won't work for you, it will be different. The datasheet for the sensor does have a curve, in figure 2 on page 5, which may be helpful if you need to estimate a calibration.
To use code someone else has written in a different environment, you often have to be able to understand every line and letter of the code. Well done for trying! If you have questions about how their code works, contact them, or reference a line here and I'll try to explain it.