I have several code snippets shared as gists in GitHub. How to make them citable with a DOI?

I know whole repositories in GitHub can be made citable using Zenodo or Figshare (guide). But as I have mainly R functions as gists, I don’t want to build entire R packages to make it citable.

What are the other options available?

  • 2
    I'm having a hard time understanding why 'code snippets' should even be cited in the first place.
    – Jon Custer
    Commented Jun 30, 2017 at 12:50
  • 1
    @JonCuster Presumably because they are used in a paper? "Calculation of the fitness value uses the public implementation of Crops [1]".
    – xLeitix
    Commented Jun 30, 2017 at 13:40
  • 1
    (of course this would require that [1] is an archival source of some type, with some expectation of remaining available for the forseeable future)
    – xLeitix
    Commented Jun 30, 2017 at 13:41
  • 1
    @xLeitix - In the old days, one would spend a sentence or two right there in the paper on the technique, perhaps using a bit of pseudo-code. Nowadays, it probably can go directly in the supplemental material. Particularly if it is just a few functions in R that are put together one would think the 'old' way would work just fine, but as supplemental material it would be a piece of cake. Then it is archived directly with the paper that it is used in.
    – Jon Custer
    Commented Jun 30, 2017 at 14:07
  • @JonCuster I imagine that OP wants to make the snippets public so that someone else can cite them. They can't just publish a snippet as supplemental material as if they wrote it themselves. Commented Jun 30, 2017 at 22:10

1 Answer 1


While not in the field, I see two options. Even if none of them is giving a doi, either:

A) Consider runmycode.org as a deposit for your code.
It is backed for example by the French CNRS, the nation's largest body of public research, the Alfred Sloan Foundation, and Elsevier as a larger publisher. One major axis of action actually is to preserve code used in journals. The service is for free, and all languages are permitted.
Consequently, Elsevier's Journal of Computational Science encourages authors to do so:

You can enrich your online article by uploading relevant computer code and data to the RunMyCode repository. Once published, your article on ScienceDirect will be linked to a dedicated RunMyCode companion website via the "Data for this article" application displayed next to the article, in the right hand side panel. This linkage will allow readers to access your code and data via the RunMyCode companion website. To create a companion website, please go to: http://www.runmycode.org/home

(source, accessed on June 30, 2017)

B) Secondly, lesser for the intended publication in a journal than for broader re-use of your coding by others, there is a dedicated CRAN website here to submit R packages to their servers. Obviously, to be checked with the policies of the targeted journal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .