Any "code" in which it is somehow unsportsmanlike and offensive to fire a slapshot at an empty yet, yet at the same time not far worse to act like a sore loser and purposefully cross checking an opponent, isn't worth its salt.
No matter how you slice it, the act committed by Rielly is worlds more egregious than what Greig did, and a far bigger violation of of any "code" hockey may have. If you can't handle being scored on - regardless of how it happens - don't get scored on, or I don't know, quit hockey or something, don't act like a toddler throwing a tantrum.