Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan McCue rmccue

View GitHub Profile
View proxy
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 Dec 3, 2009
A quick demo of how to get comments for a Blogger post with SimplePie.
View gist:248095
<?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 Dec 6, 2009
Read SimplePie cache without opening SimplePie
View gist:250195
<?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 Dec 7, 2009
Normalise SimplePie items to put into a database
View gist:250682
<?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 Dec 21, 2009
A plugin for the Great Australian Internet Blackout
View blackout.php
<?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 Dec 24, 2009
Code to make Hahlo work properly in a Prism app
View webapp.ini
[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 Mar 21, 2010
Disable Lilina's Get Satisfaction widget on public-facing site.
View disable_gsfn.php
<?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
*/
View simplepie-gametrailers.php
<?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 Apr 22, 2010 — forked from smajda/aggregate-feed.php
An improved version of the RSS merger
View aggregate-feed.php
<?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
Sort items by title instead of date
View simplepie-title-sort.php
<?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());
}