This herringbone bone gear assembly, combined with the rack, magnetic mount, shaft, rotary encoder and arduino (all in the links below), can be used as a poor man's linear encoder. The gear has a 12.1275 mm pitch radius (2.999 in circumference) and the mount is designed to hold a 1024 P/R, quadrature rotary encoder.
The housing has space for two standard skate board bearings (22mm OD, 8mm ID, 7mm width) and there is also room for two 1/2" diameter, 1/8" thickness rare earth magnets to hold the rack firmly against the pinion (you have to mount the rack on a piece of 1"x1/8' steel of course). The housing is is attached to the magnetic base using a standard 5/16 NC bolt.
Herringbone Rack: http://shpws.me/o8YN
Magnetic Mount : http://shpws.me/o8YI
Shaft : http://shpws.me/o8YP
Encoder Datasheet: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Robotics/E6B2Encoders.pdf