A source code of magic trick called "cups and balls" which uses Arduino to detect a magnet and send a signal to performer. Linear Hall Effect Sensor has been used which produces an analog signal that varies given proximity to a magnet. Useful for cases where you do not only want to detect if a magnet is nearby but also it's approximate distance.
More info here.