27

My local project has some code that is not working, and I'd like to show it to someone to have a look at and possibly give me a hand with it. This isn't a short snippet or a single file; there are multiple files and directories involved.

How can I best publish my code?

10
  • 4
    Extract the piece that is not working, make it a self-contained, executable example and post it on StackOverflow, together with a detailed description of what was the expected output and how it failed :)
    – Niklas B.
    Jun 21, 2012 at 18:48
  • 2
    There is also codereview.stackexchange.com ...
    – user160917
    Jun 21, 2012 at 20:00
  • 3
    @NiklasB. you cannot make self-contained executables of interpreted code without going through a great deal of trouble. Much more than I'd probably like to go through for just showing a quick example to someone... Jun 21, 2012 at 22:35
  • @David: I didn't mean executable in the sense of executable. I meant it in the sense of "one can copy the code and execute it without endless adaptions". A lot of supporters don't actually do that, they can often spot errors without executing the code, in which case it helps if there is as few lines of code as possible (obviously still containing the error).
    – Niklas B.
    Jun 21, 2012 at 23:29
  • 1
    @Intentss: Codereview is for working code ONLY. Stack Overflow is glad to help with broken but short code samples.
    – Niklas B.
    Jun 21, 2012 at 23:29

4 Answers 4

25

Use Launchpad's +junk branch feature to publish your code to a temporary location. In fact, it is not temporary, as it will remain there until you explicitly delete it, but it is a nice place to put unfinished code you're experimenting with on a public location.

This way it will stay out of the way from your regular branches, but you'll still be able to access it and show it to everyone online.

The only requirement is that you've got a Launchpad account and have uploaded SSH keys and finished the procedure to use Launchpad for code hosting.

After that, you simply need to run this command on your terminal, from the location where your code lives:

bzr push lp:~<your-launchpad-id>/+junk/<name-of-your-temp-branch>

That's it! You'll then be able to point other people to https://code.launchpad.net/~<your-launchpad-id>/+junk/<name-of-your-temp-branch>

3
  • So far this is the only solution that allows multiple files. THanks for sharing I can see this being handy someday. Jun 21, 2012 at 20:41
  • 1
    This can also be done using Github, BitBucket and other repository hosts in a very similar manner.
    – Niklas B.
    Jun 21, 2012 at 23:40
  • Just as a little note, the bzr push command can be abbreviated/simplified to bzr push lp:~/+junk/[branch_name] as Launchpad should reslve your username from your identifying yourself and your SSH keys.
    – nanofarad
    Oct 6, 2012 at 12:59
11

Use a GitHub gist - You don't even need to register.

3
  • 1
    A good suggestion, but that is similar to just using a pastebin, and will only let you share single files. You can put entire source trees in a +junk branch. Jun 21, 2012 at 15:46
  • @DavidPlanella, you can have multiple files in a gist (github.com/blog/550-multiple-file-gist-improvements) Jun 21, 2012 at 22:02
  • 1
    That's right, but as mentioned, you cannot keep the source tree structure there. For that, you'd need a full-blown bzr or git branch. Jun 21, 2012 at 22:30
5

There's also Codereview SE, which is in public beta. Maybe not the best place for a big project, but another option.

1
  • 3
    The Code Review SE FAQ states that the code must be working to post. If the code isn't working Stack Overflow is probably a better match.
    – DQdlM
    Jun 21, 2012 at 16:56
0

If what you want to be reviewed is a single file, you can use any one of the number of popular Pastebin services.

I would personally recommend Ubuntu's Pastebin Service.

1
  • OP is asking about multiple files
    – Moog
    Jun 26, 2012 at 19:01

You must log in to answer this question.

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