Port jsdo.it/hakim/magnetic-02

Ported from http://jsdo.it/hakim/magnetic-02
