Controlling the speed of a dc motor?

Use PWM to control speed.

Your motor will generate spikes because of this PWM (it will generate spikes anyway), so protect your electronics (the diode across the transistor in the schematics).
If you need more info, ask specific questions.

The schematics you saw at the playground are wrong (there is a warning about that directly above it).
The box with an X in it and connected to 12 volts and pin 11 (this is the error), is supposed to be the relay used to invert direction.
As you have no use for that, you can remove it and forget all about pin 3 and the relay in your sketch.
Connect one side of your motor to 12 volts, and the other side to your transistor.
If the motor runs in the wrong direction, exchange these two wires.

[edit]
Another error in those schematics: the pot to analog pin 0 is also wrong.
Analog pin 0 is supposed to be connected to the 1 K resistor and 5 volts to where Analog 0 is now (so these two are to be exchanged).
[/edit]