Skip to content

Instantly share code, notes, and snippets.

View jasonclemons's full-sized avatar

Jason Clemons jasonclemons

View GitHub Profile
@jasonclemons
jasonclemons / randomizer.php
Created June 15, 2016 23:22
TSA Queue Randomizer
<?php
function randLane()
{
$lane = rand(0, 1);
if ($lane == 0) {
return 'left';
} else {
return 'right';
@jasonclemons
jasonclemons / .htaccess
Created November 12, 2014 03:21
SMF Optimization & Backup Scripts
# 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
@jasonclemons
jasonclemons / avatar.php
Last active August 29, 2015 14:01
Simple PHP script to rotate avatar images.
<?php
class Avatar
{
public $avatar_dir;
public function headers()
{
header('Content-type: image/jpeg');
}
@jasonclemons
jasonclemons / gist:4071712
Created November 14, 2012 11:53
Google Maps location finder (based on https://gist.github.com/4066383)
<?php
class GoogleMaps {
private function find($location = null) {
if ($location == null) {
return false;
}
$uri_parts = array(
'q' => urlencode($location),
'output' => 'json',
@jasonclemons
jasonclemons / rgbhex.php
Created July 3, 2012 14:44
Simple RGB->Hex and Hex->RGB converter.
<?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
*