Writing a code snippet should be fairly self explanatory.
First, check if a code snippet that does what your does already exists. If it does, check to see if it's done in a similiar way. If it does, provide the name of the thread to include your code snippet. If not, a descriptive name for your snippet's new thread.
Code snippets should be suitable for use in production level code. The snippet will be reviewed by the board.
Snippets are assumed to be PHP. If your snippet is not PHP, you should indicate the language in the title of the thread by placing [Language] at the start. i.e.
Code: Select all
.
The title of your thread should be clear and descriptive.
When posting your snippet, if it's not extremely obvious you should give a very clear description of what your snippet does and any limitations/requirements to run it (e.g. requires PHP5). You should also include examples on its usage.
Code snippets do not need to be lengthy, complex excerpts of source code. If you have some useful code which is only a few lines long you should still offer it.
[b][size=125]Do's and Don'ts...[/size][/b]
[list]
[*][b]Do not[/b] send links to external content without posting the source code here.
[*][b]Do not[/b] send snippets that are not free to use (i.e. not licensed under the GPL, LGPL or another free software license).
[*][b]Do not[/b] send code which only works in your own application or will not be useful to other developers.
[*][b]Do[/b] include examples of how to use your snippet.
[*][b]Do[/b] state the license of your snippet where appropriate.[/list]