That's a good question. I personally often insert code samples into a post, but I think the ideal way would be to upload a file to the Library associated with the Community that makes most sense. I glanced around, and I imagine Tech Chat may be as good as any. You should be able to click the Library tab above on this page and then upload the a file there.
Then, I'd suggest putting a link here in this thread. And then when people ask questions related to this, any of us who are aware of that code can link to it or to this post in answer to those future questions people ask. For an example, this is what I currently do when people ask about extra functionality in the MS Outlook Email VBO. I link to this, depending on what functionality is being looked for:
here.
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company