This is a proposal for a sort of a middle ground between the image hosting and the LaTeX sandbox.

I have lots of bits of LaTeX code lying around in my files, and every-so-often a question evokes an answer from it which I sometimes accompany by: "I could provide more details if asked"; by which I mean, "I've got the code, it's a bit of a mess, I've been meaning to clean it up, and if someone provided the incentive by actually asking then I'll clean it up and make it public.". Normally, "make it public" means "stick it on my website" since nothing is really enough to fit into a Proper CTAN package.

Also, once or twice, a question gets me interested beyond the initial answer and I wonder, "What is really the best way to do that?" and I end up with something a little more complicated than I would really want to put in an answer, and it wasn't necessarily quite what the original questioner asked for, but still would be useful to someone interested in the same question.

I'd guess I'm not alone in that.

So I wonder what people would think of the idea of having a drop-box of some sort somewhere where people could stick snippets of code that didn't quite fit in an answer for some reason, but were still relevant in some way.

(In all fairness, I should say that I'm not completely convinced myself; but I can't think of a definite reason either way.)

| |

On a first thought, I don't think this is a good idea. If it is not answer material (but more of an "addendum") then I think there is little incentive to host it in the site. Also I don't think there is any strong reason or necessity to persist packages or files have not been "properly" prepared, tested and so on; and if they have then they should go to CTAN. For a "semi-official" publication probably the best/most sensible solution is just to host the files on our personal websites, as many of us probably already do.

| |

I agree with Juan, with slightly different reasons/priorities: setting up the software and maintaining the directory will be a lot of work, even if we do the minimal amount possible, and I’m not sure of the benefits.

Furthermore, I’m not convinced of the need, since there are alternatives:

  • For small snippets, I use a pastebin application such as Pastie.

  • For larger things with a potentially longer half-life, I suggest using an open source hosting service, such as Google Code. Hosting code there is incredibly easy once you know the absolute basics of version control systems, and the code will be very accessible.

    Furthermore, if the code happens to be useful, such a project hosting provides the perfect runway to launch the project in earnest.

(My own package, minted, is actually hosted on Google Code, although for me the order was reversed, I first submitted to CTAN and then set up the Google Code project.)

| |
  • github is pretty often used for this: googling "github code snippets" gets 134,000 results. – Charles Stewart Aug 10 '10 at 12:56
  • Alternatively, bazaar users can use the ~username/+junk folder on launchpad. – Caramdir Aug 10 '10 at 14:37
  • 1
    @Charles, true – but for snippets, github offers a specialized service called Gist – I’ve already posted one code via Gist on out lovely site. ;-) – Konrad Rudolph Aug 10 '10 at 18:44

For what it's worth, we should collect these website suggestions in our FAQ!

| |

I don't see any compelling reason to re-invent a wheel that has already been implemented by online pastebins. The only benefit I can think of is that hosting a CTAN-like archive would provide opportunities to index and tag the code snippets and make them searchable- but this is already done to a large degree by the StackExchange questions they are associated with.

Personally, if I have some code to share, I try to put the main points in code blocks within the question. Anything longer, such as complete compilable examples, that contain lots of boilerplate unrelated to the question/answer at hand I stash in a pastebin and then provide a link.

I like GitHub's gist because it is a complete versioned git repository that can be cloned or forked by other interested parties and easily migrated into a full-blown project at GitHub or any other service that supports a tool which can import a git repository.

| |

You must log in to answer this question.

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