With the help of code from Fazi bear , I have put together a gem that will pull data from the Sudden Motion Sensor chip inside Apple Macbooks and Macbook Pros.

Prior to this, to read the data you needed to interface with the external AMSTracker command line program. This is a smoother way to do it.

Why would you want this? Because now you can use this to control your code by physically moving your laptop around!

Examples here.

Sudden Motion Sensor at Rubygems.org.

Github Repo.