Bitcoin Transaction Speed If a transaction takes anywhere from around 10 minutes to hours to get written to a block and put on the chain, how is it possible to have things like bitcoin vending machines? In those cases, the transaction would have to be near instantaneous to make it practical.
Payment channels are a way to prevent double spending in such cases. As per the Wiki


  A Micropayment Channel or Payment Channel is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.[1] In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants. 


A possible way for implementing vending machines would involve creating payment channels beforehand with the vending machine company. 

Infact, for the vending machine case, an unidirectional channel would suffice. Refer to Wiki for details. Bi-directional payment channels using hashlocks are the key to Lightning network which is used to facilitate off-chain transactions at real-time.