views:

382

answers:

4

How should I license the code snippets used in my blog posts so that people feel free to use it without painful restrictions?

My (very limited) understanding of copyright tells me that without any defined license that everything is protected as copyrighted which would have severe limitations on other's use.

There's a good discussion about software licenses on Coding Horror, but the discussion doesn't specifically apply to blogs.

I like the Creative Commons Attribution 3.0 license, but from what I understand, it isn't supposed to be used with source code.

I'd rather not have a license file that needs to be distributed with little snippets of code (that makes more sense when someone is downloading an archive of some sort).

Mostly I just want someone to be able to remix/reuse as they see fit.

Any suggestions or examples of how other people are licensing code that they use on their blog?

+3  A: 

Why wouldn't you just place it in the public domain? That way anyone can use the code for whatever they want, and practically everybody understands "public domain" as opposed to "GPL/LGPL/MIT" etc.

amdfan
Aren't there also some legal issues with PD in the USA? I also don't really see the big problem with MIT/BSD.
Horst Gutmann
None that would be relevant to this question specifically, as far as I'm aware.
amdfan
I've seen occasional FUD saying that it is not possible to place a work into the public domain in the US. Creative Commons disagrees.
Steve Jessop
Most of the FUD about public domain is simply that - FUD. The only problem with putting code into the public domain is that some organizations may not feel comfortable with the 'provenance' of the code (no one 'owns' it). For snippets, I can't imagine this would ever be a real problem.
Michael Burr
IANAL but FWIW I think you still retain the copyright to your work in the US, even if you declare it "public domain". Just for all intents and purposes you've released it under a license that provides identical rights.
emddudley
+2  A: 

If you're in the US, IIRC you can place a work into the public domain by declaring it so. Creative Commons will do a "public domain dedication" for you, and retain it in their records, but legally you don't have to go through their web form every time, just use the relevant incantations.

Whether this is possible in other jurisdictions (including my own) is a bit less clear, but it does at least clearly indicate your intention.

My own userinfo contains the following text, which I basically made up from memory based on things I've seen before. Again, its legal weight and bullet-proof-ness are doubtful but intent is clear, so I hope that my heirs will never attempt to assert intellectual property, and that if they do they will be unsuccessful:

" All my original contributions to StackOverflow are placed into the public domain. If this is not legally possible, then anyone receiving a copy of them by any means is granted a non-exclusive perpetual license to use, distribute and modify them, and to distribute modifications, under any license or none, with or without attribution to me. "

Steve Jessop
There is no formal legal method of revoking your copyright on a work in the US. The closest you can get is something like the CC public domain dedication (and the example text you provided above), where you grant everyone a license to do anything and everything with your work.
emddudley
+2  A: 

Just put some text in the footer "The code? Meh - have at it, people"

This answer is released under the Hang On Aren't We Overthinking Things A Bit Here Public License. If you wish to think the thought expressed in the answer, please credit me by muttering my username under your breath.

mackenir
+4  A: 

If you're a little worried about the legality or usability of public domain, you could use the Creative Commons Zero or CC0 license. It's designed to be as close to public domain as possible, worldwide. There is a FAQ.

And of course, there's always the WTF Public License. :-)

Evan
+1 for mentioning the WTF Public License.
iconiK