Skip to content

Instantly share code, notes, and snippets.

View shupp's full-sized avatar

Bill Shupp shupp

  • MasterClass
  • South San Francisco, CA
View GitHub Profile
@shupp
shupp / realtime.php
Last active April 15, 2024 17:23
Real Time ISS Location Example
<?php
date_default_timezone_set('America/Los_Angeles');
require_once 'Predict.php';
require_once 'Predict.php';
require_once 'Predict/Sat.php';
require_once 'Predict/QTH.php';
require_once 'Predict/Time.php';
require_once 'Predict/TLE.php';
@shupp
shupp / gist:960980
Created May 7, 2011 23:56
Example call to producer
<?php
$producer = new EC_Producer();
$producer->addJob('hello_world', 'HelloWorld', array('foo' => 'bar'));
?>
@shupp
shupp / example.txt
Created May 7, 2011 23:55
Example Debug Output
./bin/consumer_cli.php -e development -s 127.0.0.1:22133 -q hello_world -d -m 2
Nothing on queue enterprise_hello_world
Nothing on queue enterprise_hello_world
Nothing on queue enterprise_hello_world
Nothing on queue enterprise_hello_world
Running EC_Job_HelloWorld on instance dev under environment development
Hello, world! Here is my data array:
stdClass Object
(
[foo] => bar
@shupp
shupp / EC_Consumer.php
Created May 7, 2011 23:46
Kestrel Consumer
<?php
/**
* Enterprise queue consumer interface, called by bin/consumer_cli.php
*
* @author Bill Shupp <hostmaster@shupp.org>
* @copyright 2010-2011 Empower Campaigns
*/
class EC_Consumer
{
@shupp
shupp / EC_KestrelClient.php
Created May 7, 2011 23:38
Kestrel Client Decorator
<?php
/**
* A thin kestrel client that wraps Memcached (libmemcached extension)
*
* @author Bill Shupp <hostmaster@shupp.org>
* @copyright 2010-2011 Empower Campaigns
*/
class EC_KestrelClient
{
/**
@shupp
shupp / EC_Producer.php
Created May 7, 2011 23:32
Kestrel Producer
<?php
/**
* Interface for adding jobs to a queue server
*
* @author Bill Shupp <hostmaster@shupp.org>
* @copyright 2010-2011 Empower Campaigns
*/
class EC_Producer
{
/**
@shupp
shupp / consumer_cli.php
Created May 7, 2011 23:29
CLI harness for EC_Consumer
#!/bin/env php
<?php
// External application bootstrapping
require_once __DIR__ . '/cli_init.php';
// Instantiate and run the consumer
$consumer = new EC_Consumer($argv);
$consumer->run();
@shupp
shupp / gist:879949
Created March 21, 2011 18:40
Example view helper for media urls
<?php
class Zend_View_Helper_MediaURL extends Zend_View_Helper_Abstract
{
/**
* Retrieves the full URL for a static media element, based on the path
*
* @param string $path The path of the file, including the '/' prefix
*
* @return string
*/
@shupp
shupp / gist:879805
Created March 21, 2011 17:12
Example call to view helper
<link rel="stylesheet" type="text/css" href="<?php echo $this->mediaURL('/css/core-style.css') ?>">
@shupp
shupp / gist:879762
Created March 21, 2011 16:49
Example rewrites for ignoring version
RewriteEngine On
RewriteRule ^v/([0-9a-fA-F]{8})/(js|css|img)/(.*)$ /$2/$3 [NC,L]