This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DateFormat { | |
const DATE_SHORT = 'Y-m-d'; | |
const DATE_LONG = 'F j, Y'; | |
const DATETIME_SHORT = 'Y-m-d H:i'; | |
const DATETIME_LONG = 'F j, Y, g:i a'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = 'localhost'; // MYSQL database host adress | |
$db = ''; // MYSQL database name | |
$user = ''; // Mysql Datbase user | |
$pass = ''; // Mysql Datbase password | |
// Connect to the database | |
$link = mysql_connect($host, $user, $pass); | |
mysql_select_db($db); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
By Marco Arment <me@marco.org>. | |
This code is released in the public domain. | |
THERE IS ABSOLUTELY NO WARRANTY. | |
Usage example: | |
// In a registration or password-change form: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* List of currencies | |
* @see ISO 4217 | |
* @var array | |
*/ | |
$currency = array( | |
'AUD' => array( | |
'title' => 'Australian Dollar', | |
'symbol_left' => '$', // $ | |
'symbol_right' => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://goo.gl/16DdO'; | |
$headers = get_headers($url); | |
$headers = array_reverse($headers); | |
foreach($headers as $header) { | |
if (strpos($header, 'Location: ') === 0) { | |
$url = str_replace('Location: ', '', $header); | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Validate JSONP Callback | |
* | |
* https://github.com/tav/scripts/blob/master/validate_jsonp.py | |
* https://github.com/talis/jsonp-validator/blob/master/src/main/java/com/talis/jsonp/JsonpCallbackValidator.java | |
* http://tav.espians.com/sanitising-jsonp-callback-identifiers-for-security.html | |
* http://news.ycombinator.com/item?id=809291 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$headers = apache_request_headers(); | |
foreach ($headers as $header => $value) { | |
echo "$header: $value <br />\n"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createQR($url,$size ='150',$evLevel='L',$margin='0') { | |
$url = urlencode($url); | |
return '<img src="http://chart.apis.google.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=' . $evLevel . '|' . $margin . '&chl=' . $url . '" alt="QR code" width="' . $size . '" height="' . $size . '"/>'; | |
} | |
echo createQR('http://www.wickedbrilliant.com',150); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable plugins when doing local dev | |
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify | |
Version: 0.1 | |
License: GPL version 2 or any later version | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function percentChange($oldNos = 0, $newNos = 0) { | |
$scratchSheet = ($newNos + 0) - ($oldNos + 0); | |
return round((($scratchSheet / $oldNos) * 100),2); | |
} | |
?> |
OlderNewer