Below are the top ranked snippets.
5
Reg exp for finding url and email adresses. i'm using this from any projects of me. they working
6
Create a regular expression pattern matching any positive number that is less than or equal to the given max number
Example:
pattern = createRegExNumberPattern( 950 )
print pattern
([0-8]\d\d)|(9[0-4]\d)|(950)
Example:
pattern = createRegExNumberPattern( 950 )
print pattern
([0-8]\d\d)|(9[0-4]\d)|(950)
5
A simple implementation of IServiceProvider for use in plugin style architectures.
7
This function will reverse the affects of register_globals
5
This small snippet will not allow _POST requests from a 'foreign' domain. It relies on the HTTP_REFERER variable.
10
This simple function will check if a url is valid (going by parse_url()) and if it's 'online' - by seeing if it returns a 302, 301, or 200 status code.
7
This class can be used to retrieve the search words entered by an user in a search engine site that lead the user to the current page.
The class can parse the HTTP_REFERER variable if present. Then it can detect which search engine site lead the user to the current page, and extract the search words.
Currently the following engines are supported:
- Google
- Yahoo
- MSN
- AllTheWeb
- LookSmart
- AskJeeves
The class can parse the HTTP_REFERER variable if present. Then it can detect which search engine site lead the user to the current page, and extract the search words.
Currently the following engines are supported:
- Yahoo
- MSN
- AllTheWeb
- LookSmart
- AskJeeves
6
This class is a MySQL database access wrapper. It can:
- Connect to a MySQL server
- Execute SQL queries and retrieve single value results or return result rows into arrays
- Return the last inserted table row identifier, the number of result rows and the number of affected rows
- Count the number of executed queries
- Lock and unlock tables
- Escape text literal values or like patterns
- Retrieve database access errors
- Connect to a MySQL server
- Execute SQL queries and retrieve single value results or return result rows into arrays
- Return the last inserted table row identifier, the number of result rows and the number of affected rows
- Count the number of executed queries
- Lock and unlock tables
- Escape text literal values or like patterns
- Retrieve database access errors
5
This class implements a simple template engine that works by replacing text.
It can read a template file into a string. Then it searches and replaces all occurrences of the template place holder marks with the values of one or more template arguments.
It can read a template file into a string. Then it searches and replaces all occurrences of the template place holder marks with the values of one or more template arguments.
7
A websafe colour palette generator in JavaScript. Coded this after looking at http://www.bytemycode.com/snippets/snippet/585/ and wanting to do it differently.
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles









