Skip to content

Instantly share code, notes, and snippets.

@mageekguy
mageekguy / psr4.php
Last active July 8, 2020 19:48
Very simple PSR-4 autoloader
<?php
namespace your\namespace\here;
spl_autoload_register(function($class) {
if (stripos($class, __NAMESPACE__) === 0)
{
@include(__DIR__ . DIRECTORY_SEPARATOR . 'classes' . str_replace('\\', DIRECTORY_SEPARATOR, strtolower(substr($class, strlen(__NAMESPACE__)))) . '.php');
}
}
@localpcguy
localpcguy / swipeFunc.js
Created November 17, 2011 16:00
Simple Mobile Swipe function to get the swipe direction
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){