Not Updated For Current Season
The masteries shown here are not yet updated for the current season, the guide author needs to set up the new masteries. As such, they will be different than the masteries you see in-game.
against a heavy magic team you get:
Boots of Swiftness
Rylai's Crystal Scepter
Force of Nature
Select what you need and what your preferences are. I don't usually get Mejai's at all. I just don't think it's a helpful item since it takes time to be worth it.
Early game you should always get Haunting Guise, Boots of swiftness, and Spirit Visage.
Late game you will always sell Haunting Guise, and never skip Zhonya's Ring or Rlyai's Crystal Scepter. If the enemy team is physical damage heavy you might want to sell spirit visage too though.
I am very aggressive early game and never give my mid lane opponent an inch. I force him back and I don't let him get any exp, thus making all flat runes effective.