Skip to content

Instantly share code, notes, and snippets.

View rmccue's full-sized avatar

Ryan McCue rmccue

View GitHub Profile
@rmccue
rmccue / proxy
Created September 30, 2009 07:36
From 253278458860aadf0d25b11351357bcf90c6db7a Mon Sep 17 00:00:00 2001
From: Ryan McCue <me+gist197903@ryanmccue.info>
Date: Tue, 29 Sep 2009 19:41:53 +1000
Subject: [PATCH] Add proxy support. Closes #19
---
simplepie.inc | 78 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 60 insertions(+), 18 deletions(-)
diff --git a/simplepie.inc b/simplepie.inc
@rmccue
rmccue / gist:248095
Created December 3, 2009 11:59
A quick demo of how to get comments for a Blogger post with SimplePie.
<?php
$sp = new SimplePie('http://example.com', './cache');
foreach($sp->get_items() as $item) {
echo '<h2>' . $item->get_title() . '</h2>';
$link = $item->get_link(0, 'replies');
if($link) {
$comments = new SimplePie($link);
foreach($comments->get_posts() as $comment) {
echo 'Comment: ' . $comment->get_content();
@rmccue
rmccue / gist:250195
Created December 6, 2009 12:16
Read SimplePie cache without opening SimplePie
<?php
require('simplepie.inc');
$cache = SimplePie_Cache::create($cache_location, md5($url), 'spc');
// Load data
$data = $cache->load(); // returns instance of SimplePie
// Get timestamp
$time = $cache->mtime(); // returns integer
@rmccue
rmccue / gist:250682
Created December 7, 2009 07:15
Normalise SimplePie items to put into a database
<?php
require('simplepie.inc');
$feed = new SimplePie('http://example.com/feed/');
foreach($feed->get_items() as $item) {
$new_item = (object) array(
'hash' => $item->get_id(true),
'timestamp' => $item->get_date('U'),
'title' => $item->get_title(),
'content' => $item->get_content(),
@rmccue
rmccue / blackout.php
Created December 21, 2009 16:19
A plugin for the Great Australian Internet Blackout
<?php
/*
Plugin Name: Blackout your Blog
Description: From Monday, January 25th to Friday, January 29th, Aussie websites will turn their lights out — "black out" — to inform Australians about the threat of imposed Internet censorship. Pledge your support, and install this plugin!
Version: 1.0
Author: Ryan McCue
*/
function blackout_js() {
?>
@rmccue
rmccue / webapp.ini
Created December 24, 2009 09:52
Code to make Hahlo work properly in a Prism app
[Parameters]
id=hahlo@prism.app
name=Hahlo
uri=http://hahlo.com/
icon=webapp
status=false
location=false
sidebar=false
navigation=false
trayicon=false
@rmccue
rmccue / disable_gsfn.php
Created March 21, 2010 21:09
Disable Lilina's Get Satisfaction widget on public-facing site.
<?php
/*
Plugin Name: Disable Feedback Widget
Plugin Description: Disables the feedback widget on a public site
Plugin URI: http://getlilina.org/
Author: Ryan McCue
Author URI: http://ryanmccue.info/
Version: 1.0
Min Version: 1.0
*/
<?php
// Extend SimplePie to retrieve the embed data from a GameTrailers.com feed
// Load SimplePie
include('simplepie.class.php');
// Define the GameTrailers namespace
define("SIMPLE_NAMESPACE_GAMETRAILERS", "http://www.gametrailers.com/rssexplained.php");
// Extend SimplePie_Item with our own class
@rmccue
rmccue / aggregate-feed.php
Created April 22, 2010 08:25 — forked from smajda/aggregate-feed.php
An improved version of the RSS merger
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/
@rmccue
rmccue / simplepie-title-sort.php
Created May 14, 2010 06:03
Sort items by title instead of date
<?php
require_once('/(path-remove-for-security)/simplepie.inc');
class SimplePie_Title_Sort extends SimplePie {
function sort_items($a, $b)
{
return strlen($a->get_title()) >= strlen($b->get_title());
}