Matthew G. and Irwin have given great answers, but I'd like to provide some additional resources and references for those interested.
First, take a look at answers to this similar question on scicomp.SE:
Reproducibility was the subject of a 2012 workshop at ICERM; you'll find a lot of useful material on the wiki and in the final report (see especially appendices D, E, and F).
Archival/hosting
Update:You can get a DOI and permanent hosting for a snapshot of your code via Figshare or Zenodo.
Licensing
See this section of the wiki for an extensive list of resources.
Making it easy to run the code
There are some sites and tools out there aimed specifically at this. These also solve the hosting issue:
- ActivePapers: An ActivePaper is a single file containing all the software and datasets related to a research project.
- RunMyCode: This service is based on the innovative concept of a companion website associated with a scientific publication.
A major hurdle is often re-creating the correct environment (including libraries and such) necessary to run the code. To overcome this, you could
- distribute a virtual machine or use Vagrant or CDE
- ensure that your code runs on some cloud platform, like
- Wakari
- SageMathCloud
- Amazon web services
- Windows Azure
It can be useful to put your code in a worksheet format, where you can intersperse comments and even mathematical formulas (for instance, using the IPython notebook or a Sage worksheet. Here is an example.
Examples
Finally, herearesomeexamples of my own efforts. They're far from perfect, but may still be helpful.