Snippet library (beta)
Being a developer is hard. You write tons of code and sometime you know that you already wrote a certain thing or researched a certain bugfix, but you just cannot find it because you have no central place to store this thing. This is what the Sourcebench snippet library is all about. As we are a team of developers who faced exactly this problem and rather invented the wheel over and over again we needed a place to store our bug fixes, snippets and other little helpers.
This snippet library allows us to keep all this little snips of code in one place. Search them, categorize them and share them with other people and keep everything at hand from wherever you are.
The Snippet-library categories
Login or register now and get more features!
You must be logged in to post a snippet. Login or register now to post your own snippets.
Latest community snippets
Fixing timezones the easy way
- October 25th, 2007
- php
I just ran into some trouble with an interface that is running on a germany based server but is accessed from a server in the U.S. and also in german. So when a client ie opens a ticket it will appear with the german time. An easy way to fix this issue on a linux based system is by setting the timezone environment with putenv.
validate email address
- October 24th, 2007
- php
Small function to validate an email address using preg_match. Returns TRUE if valid, false otherwise.
Convert dos linebreaks without dos2unix available
- October 18th, 2007
- linux
Sometimes its necessary to convert files that are written by a windows software, when they are supposed to run in linux. These files usually include a "\n\r" sequence at the end of a line. In linux only "\n" is expected. Usually there is dos2unix available for such purposes, but sometimes it's just missing. Then tr (truncate) comes to a rescue.
Redirecting non ssl requests to ssl version of your site
- October 12th, 2007
- apache
Sometimes you might want your clients to run only through your ssl protected version of your homepage or shop. In this case it is necessary to redirect all visitors that open the http:// based (non ssl) url of your site to the https:// based (ssl protected) url of your site. The following snipplet for your apache vhost configuration does exactly this.(via )
PHP Environment overview
- October 12th, 2007
- php
This is a small script to get quick overview of your current php installation. Helps when trying to debug something to have a first clue on system and settings. (via )















