[HOW TO] Submitting Code Snippets

Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

[HOW TO] Submitting Code Snippets

Post by Chris Corbyn »

This forum is locked to the creation of new threads. If you wish to post a code snippet, first read the guidelines below before finally private messaging a moderator with your thread.

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]
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

If you wish to post a code snippet, first read the guidelines below before finally private messaging a moderator with your thread.
Wouldnt it be easier if it were set like, users can post but not visible until its approved ?

And why all of a sudden this restriction ?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

anjanesh wrote: Wouldnt it be easier if it were set like, users can post but not visible until its approved ?
No, becuase that would require modification to phpBB
anjanesh wrote:And why all of a sudden this restriction ?
Becuase people had started posting snippets that were, shall we say, not very well done.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

No, becuase that would require modification to phpBB
Is there some widely avaialable module for this ? Because I've seen this in many phpBB forums.
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Post by NiGHTFiRE »

In a lot of forums you have one forum for everyone to post their codes and then moderators and administrators can approve the codes and it comes to a diffrent forum. That might be something?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

anjanesh wrote:
No, becuase that would require modification to phpBB
Is there some widely avaialable module for this ? Because I've seen this in many phpBB forums.
The tutorials forum here works the way the snippets section will now work. It has worked very well, without a mod, for over a year.

From an end-user point of view, the only difference is that you are posting your proposed snippet in a PM instead of a forum post. Thats not worth installing a mod for.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Can we continue this discussion here: viewtopic.php?t=50249

Saves cluttering the sticky. Thanks.
Post Reply