src: http://stackoverflow.com/questions/9960908/permutations-in-javascript