Skip to content

Instantly share code, notes, and snippets.

View paulferrett's full-sized avatar

Paul Ferrett paulferrett

  • Melbourne, Australia
View GitHub Profile
@paulferrett
paulferrett / urlsigning.php
Last active December 25, 2021 14:00
Simple URL signing helper class written in PHP. Use this to generate and verify signed URLs with a shared secret.
<?php
/**
* Url Signing Helper Class
*
* @author Paul Ferrett <paul.ferrett@servicecentral.com.au>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
class UrlSigning {
@paulferrett
paulferrett / abn_validator.php
Created December 27, 2013 01:45
Here is a PHP validation class to validate Australian Business Numbers (ABN) and Australian Company Numbers (ACN)
<?php
/**
* ABN and ACN Validator Class
* @author Paul Ferrett, 2009 (http://www.paulferrett.com)
*/
class AbnValidator {
/**
* Return true if $number is a valid ABN
@paulferrett
paulferrett / imagick_average_colour.php
Created December 23, 2013 14:40
This function will get the average colour of an image file using PHP and Image Magick using the IMagick extension.
<?php
/**
* Get the average pixel colour from the given file using Image Magick
*
* @param string $filename
* @param bool $as_hex Set to true, the function will return the 6 character HEX value of the colour.
* If false, an array will be returned with r, g, b components.
*/
function get_average_colour($filename, $as_hex_string = true) {