Function to move the head of an array by x positions – elements are moved to the end of the array, with order preserved.

Dirty:

Verbose:

Usage:

POC: http://jsfiddle.net/moagrius/gJ5rZ/