Skip to content

Instantly share code, notes, and snippets.

View tjlytle's full-sized avatar

Tim Lytle tjlytle

View GitHub Profile
@tjlytle
tjlytle / gist:556771
Created August 29, 2010 22:38
History Action Helper
<?php
require_once 'Zend/Controller/Action/Helper/Abstract.php';
require_once 'Zend/Controller/Action/HelperBroker.php';
require_once 'Zend/Session/Namespace.php';
/**
* This helper tracks the user's browsing history
*
* @copyright 2008 Jani Hartikainen <www.codeutopia.net>
* @author Jani Hartikainen <firstname at codeutopia net>
@tjlytle
tjlytle / drop.sh
Created May 27, 2010 22:13
Drop.io Shell Script
#!/bin/bash
#I am not a bash scripter, this is my feeble attempt to create
#a drop.io cli uploader by cobbling together various ideas found
#on the internet. Perhaps someone will see this and say, "Silly
#bash script n00b, I'll show you how it's done."
#
#That's fine by me.
drop()
@tjlytle
tjlytle / gist:327869
Created March 10, 2010 13:38
Simple RSS to Email
<?php
$to = LIST_ADDRESS;
$from = SENDER;
$rss = 'http://chileoutreach.posterous.com/rss.xml';
$client = new Zend_Http_Client($rss);
$response = $client->request();
if(($status = $response->getStatus()) !== 200){
@tjlytle
tjlytle / gist:321278
Created March 4, 2010 01:00
Twilio Gets Drop.io
<?php
$ch = curl_init("http://api.drop.io/drops");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('version' => '2.0', 'api_key' => 'API_KEY'));
$return = curl_exec($ch);
$xml = new SimpleXMLElement($return);
?>
<Response>
@tjlytle
tjlytle / imageColor.php
Created November 17, 2009 19:19
Class to find 'average' image color.
<?php
/**
* imageColor
*
* Shows three methods to find the 'average' image color.
*
* Each function expects a gd image object.
*
* imageColor::averageResize($image) resizing to 1px, and checking the color.
* imageColor::averageBorder($image) find the average color of all border pixels.