Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / snip.conf
Created May 16, 2011 16:49
Ignore for Zend Studio/Eclipse
global-ignores = \.settings \.buildpath \.project
@zircote
zircote / Metadata.php
Created May 31, 2011 02:55
A Zend Framework class to fetch EC2 instance meta-data
<?php
require_once 'Zend/Service/Abstract.php';
/**
*
*
* @author zircote@zircote.com
*
* <code>
* <?php
* $metadata = new Zircote_Service_Ec2_Metadata;
@zircote
zircote / build.xml.diff
Created June 2, 2011 14:46
DocBlox from PHPDocumenter
diff --git build.xml build.xml
index 0342c23..2608ddf 100644
--- build.xml
+++ build.xml
@@ -26,7 +26,7 @@
</target>
<target name="parallelTasks"
- description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
+ description="Run the pdepend, phpmd, phpcpd, phpcs, docblox and phploc tasks in parallel using a maximum of 2 threads.">
@zircote
zircote / Jeffe.php
Created June 3, 2011 18:49
Rediska Worker/Queue Pair for Recurring Tasks
<?php
$options = array('namespace' => 'WorkerProcess_',
'servers' => array(array('host' => '127.0.0.1', 'port' => 6380)));
/* el Jeffe */
$redis = new Rediska($options);
while (true) {
$first_url = $redis->popFromListBlocking(SRC_QUEUE, 0, SRC_QUEUE);
if($first_url){
$redis->appendToList(WORK_QUEUE, $first_url);
}
@zircote
zircote / Api.php
Created June 4, 2011 14:16
Unit Testing Web-Services With Zend Framework
<?php
class Api extends Zend_Http_Client
{
/**
*
* @group Account
*/
public function accountStatus()
{
@zircote
zircote / Model_BugsServiceAcl.php
Created June 10, 2011 16:01
Redis/Rediska Backed Zend_Acl Container
<?php
/**
*
* This could be a mechanism that builds acl lists from the database or file
* based storage.
* @author zircote
*
*/
class Model_BugsServiceAcl
{
@zircote
zircote / PrivateIPAssertion.php
Created June 13, 2011 06:00
Private IP address Zend_Acl Assertion
<?php
require_once 'Zend/Acl/Assert/Interface.php';
/**
*
* Assert the REMOTE_ADDR of the reqeust is from a private IP address
* @author zircote
*
*/
class PrivateIPAssertion implements Zend_Acl_Assert_Interface
{
@zircote
zircote / prowl-logging.php
Created July 2, 2011 22:30
A Prowl Log Writer for Zend_Log
<?php
$prowl = array(
'apikey' => '072a7159e...e36ebe57',
// 'apikey' => array('072a7159e...e36ebe57','072a7159e...e36ebe57','072a7159e...e36ebe57'), //for multi-keys
'priority' => Skulk_Client_Message::PRIORITY_EMERGENCY, // optional
'url' => 'http://www.zircote.com/admin/console', // optional url to forward the user to.
'event' => 'Error logging via Prowl with Zend_Log', // optional Your message header
// 'providerkey' => '072a7159e9e8f......e7765cd11c229e36ebe57' // optional
);
@zircote
zircote / Bayuex.php
Created July 27, 2011 21:32
BayueX Client for PHP utlizing Zend_Service_Abstract
<?php
require_once 'Zend/Service/Abstract.php';
require_once 'Zend/Json.php';
/**
* A PHP CometD Publisher
* @author zircote / Robert Allen
* Publishing:
* <code>
* $bayuex = new Bayuex('http://localhost:8080');
* $i = 0;
@zircote
zircote / ssh.sh
Created September 26, 2011 21:45
Convert a AWS PEM into a ssh pub key
ssh-keygen -y -f private_key1.pem > public_key1.pub