1. Close your Facebook profile
Don't ignore or open it rarely - close it.
2. IDE on full screen
Also Skype on DND, no notifications, no sounds, no popups.
3. Listen to trance music
Listening to repeatable music helps thinking on the important part of what you're doing, not the lyrics.