How To: Adding New 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
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

How To: Adding New Code Snippets

Post by jason »

Writing a code snippet should be easy, and 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, include your code snippet in that snippet's thread. If not, give your snippet a new thread. Also, try and post a link in the older thread about your snippet, and vice versa.

The code snippets should be named in a simple way, such as

Type: Name

So for example, a code snippet for Regular expressions for Postal codes should be named:

Regex: Postal Codes

Try to follow everyone else's lead, and using existing types if they are already being used.

Snippets should describe what they do, along with a simple sample.

Code Snippets will assumed to be for use in PHP. If the code snippet is NOT PHP, define it in the subject line.

CSS: Three Column Layout
SQL: Country Codes
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Excellent, I should be an expert at this ;)
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Might also be useful to show requirements if any. E.g. Some functions only work on newer versions of PHP, for example, file_put_contents()
Post Reply