You have to add the NeoPixel Library from Adafruit to your Arduino IDE : https://github.com/adafruit/Adafruit_NeoPixel
I use Arduino IDE 1.6.5_r5 to write and transform the code from here : https://learn.adafruit.com/multi-tasking-the-arduino-part-3
More informations about the glowing hat : http://anderson69s.com/2015/05/02/glowing-hat-v2/