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 | |
/** | |
* 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 { |
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 | |
define('ISM_API_KEY', "your client key"); | |
define('ISM_API_SECRET', "your client secret"); | |
define('ISM_API_TOKEN', "user/client token"); | |
$client = new ISM_Client(ISM_API_KEY, ISM_API_SECRET); | |
$client->setToken(ISM_API_TOKEN); | |
$jobs = $client->apis->jobs()->getJobs(); |
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 | |
/** | |
* 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) { |
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 | |
class XML { | |
/** | |
* Encode an object as XML string | |
* | |
* @param Object $obj | |
* @param string $root_node | |
* @return string $xml | |
*/ |
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 | |
/** | |
* Get the ordinal suffix of an int (e.g. th, rd, st, etc.) | |
* | |
* @param int $n | |
* @param bool $return_n Include $n in the string returned | |
* @return string $n including its ordinal suffix | |
*/ | |
function ordinal_suffix($n, $return_n = true) { |
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 | |
/* | |
Script to bulk import users into a Joomla installation (v 1.5.7). | |
This script is free to use, modify and distribute, | |
however is comes with absolutely no guarantees! | |
Be careful and check everything in here before running | |
it on your installation - has little to no error checking and is |
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
delimiter // | |
DROP PROCEDURE IF EXISTS INNODB_TRUNCATE// | |
CREATE PROCEDURE INNODB_TRUNCATE(IN tbl CHAR(128)) | |
BEGIN | |
SET @tbl_tmp = CONCAT(tbl, '_idbtrunc_tmp'); | |
SET @tbl = tbl; | |
SET @v = CONCAT("DROP TABLE IF EXISTS ", @tbl_tmp); | |
PREPARE drop_tmp FROM @v; |
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
/** | |
* Create a new wrapper to the Prototype Template class to | |
* allow default values for the template | |
* | |
* @param template | |
* @param defaults | |
*/ | |
var TemplateWithDefaults = Class.create(Template, { | |
initialize: function($super, template, defaults, pattern) { | |
this.defaults = defaults || {}; |
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 | |
/** | |
* ABN and ACN Validator Class | |
* @author Paul Ferrett, 2009 (http://www.paulferrett.com) | |
*/ | |
class AbnValidator { | |
/** | |
* Return true if $number is a valid ABN |
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 Acme\YourBundle\Serializer; | |
use JMS\Serializer\Context; | |
use JMS\Serializer\JsonSerializationVisitor; | |
use JMS\Serializer\Metadata\ClassMetadata; | |
/* | |
* Copyright 2014 Paul Ferrett <paul@paulferrett.com> |
OlderNewer