Instantly share code, notes, and snippets.

View randomizer.php
<?php
function randLane()
{
$lane = rand(0, 1);
if ($lane == 0) {
return 'left';
} else {
return 'right';
View .htaccess
# Turn it on
ExpiresActive On
# Set a default expiry time. One hour is fine, but a day or longer may be appropriate.
ExpiresDefault A3600
# Turn expiry off for dynamic content (or potentially dynamic content).
ExpiresByType application/x-httpd-php A0
ExpiresByType application/x-python-code A0
ExpiresByType text/html A0
View avatar.php
<?php
class Avatar
{
public $avatar_dir;
public function headers()
{
header('Content-type: image/jpeg');
}
View cookie.php
View gist:4071712
<?php
class GoogleMaps {
private function find($location = null) {
if ($location == null) {
return false;
}
$uri_parts = array(
'q' => urlencode($location),
'output' => 'json',
View rgbhex.php
<?php
/**
* HEX to RGB and RGB to HEX converter
* Thanks to hafees@msn.com on php.net for the base
* http://www.php.net/manual/en/function.hexdec.php#99478
*/
/**
* Convert an RGB array to HEX
*