I haven't frequented IRC much since the mid to late 90's so perhaps it has those features now.
The standard answer is "pastebin" but that raises the barrier to entry, so to speak. We use Hipchat at work but I assume Slack has feature parity here: If I want to paste a code block to discuss, I literally press paste (ctrl+v) and send (enter). The first few lines show up for everybody, with an "expand" button so they can see the whole thing.
No one has to have a specific client, no one has to visit a separate website (including me). It. Just. Works.
Same goes for images, by the way: I can post a URL ending in jpg/png/gif and it shows up for everybody, inline (and intelligently: resized, and animated gifs are hidden by default). I can also screenshot an image and paste it into chat, and it automatically converts to an uploaded file: take screenshot, press ctrl+v, enter, image is there.