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; |
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; | |
/** 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
/** 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
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.ArrayList; | |
import java.util.List; | |
/** | |
* <p> | |
* A simple facility to support design-by-contract principles. | |
* Significantly smaller and simpler than other more heavy-weight frameworks | |
* (such as contract2j, OVal, etc) but provides better functionality over the |
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.android.util; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.LinkedBlockingDeque; | |
import android.util.Log; |
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.ref.SoftReference; | |
import java.lang.reflect.Array; | |
/** | |
* <p> | |
* A small, compact in-memory cache designed for high data throughput. | |
* The cache can be simply integrated with existing source using the following | |
* pattern; |
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.reflect.Field; | |
/** | |
* <p> | |
* A utility to assist in creating <code>hashCode()</code> implementations. | |
* Can simply be used like so; | |
* </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 | |
function prettyDate($date){ | |
$time = strtotime($date); | |
$now = time(); | |
$ago = $now - $time; | |
if($ago < 60){ | |
$when = round($ago); | |
$s = ($when == 1)?"second":"seconds"; | |
return "$when $s ago"; | |
}elseif($ago < 3600){ |
NewerOlder