I remember that Heracronite was available through a code event, but the event ended. Is there any other way I can get Heracronite?
You can't get it by yourself, sorry. (Source)
However, if you trade with someone that attaches a Heracronite to the Pokemon they're trading, you will get the Mega Stone, as you get the items Pokemon hold in a trade.
Hope I helped!