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
package net.zeddev.util; | |
import java.lang.annotation.Annotation; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.logging.Level; |
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
package net.zeddev.util; | |
import java.util.concurrent.Semaphore; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import net.zeddev.util.AnnotatedLogger.LogName; | |
import static net.zeddev.util.Assertions.*; | |
/** | |
* <p> |
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 | |
/** | |
* Converts to JSON, in a 'pretty', human readable format (yet still | |
* valid JSON). | |
* | |
* This code was modified from this GitHub | |
* <a href="https://gist.github.com/GloryFish/1045396">Gist</a>. | |
* | |
* @param string $json The JSON code to prettify. |
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
/** jQuery plugin to preload images */ | |
$.fn.preload = function() { | |
this.each(function(){ | |
$('<img/>')[0].src = this; | |
}); | |
} | |
// use like so: | |
$(['img/pic1.jpg', 'img/pic2.jpg', ...]).preload(); |
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 | |
namespace \net\zeddev\util; | |
/** An error while uploading. */ | |
class UploaderException extends \Exception { } | |
/** An invalid type for uploaded file. */ | |
class UploaderTypeException extends UploaderException { } |
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 | |
namespace \net\zeddev\util; | |
/** | |
* A simple utility to dynamically create thumbnail images. Images can be | |
* stored on disk, or served on the fly (depending how constructed). For | |
* example: | |
* | |
* $ondisk = new Thumbnailer('thumbnail/dir/path'); |
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 | |
namespace net\zeddev\util; | |
// start session if not already | |
if (session_id() == '') | |
session_start(); | |
/** | |
* Utility to prevent cross-site request forgeries (XSRF) using a request scoped |
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 | |
/** Returns a fuzzy/approx of a date in the past. */ | |
function fuzzyDate($date){ | |
$time = strtotime($date); | |
$now = time(); | |
$ago = $now - $time; | |
if ($ago < 60) { |
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: Routes for WordPress | |
* Description: Routes class provider plugin | |
* Version: 2.0 | |
* Author: Zachary Scott | |
*/ | |
namespace zacscott; |
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: Purge Cache | |
* Description: Allow admins to purge the WordPress cache | |
* Version: 1.1 | |
* Author: Zachary Scott | |
*/ | |
namespace zacscott; |