Skip to content

Instantly share code, notes, and snippets.

@mhawksey
mhawksey / tt-tweet.php
Created February 16, 2010 22:31
Timed Text from Tweets
<?php
$headerTT = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<tt xmlns=\"http://www.w3.org/2006/10/ttaf1\" xmlns:ttp=\"http://www.w3.org/2006/10/ttaf1#parameter\" ttp:timeBase=\"media\" xmlns:tts=\"http://www.w3.org/2006/10/ttaf1#style\" xml:lang=\"en\" xmlns:ttm=\"http://www.w3.org/2006/10/ttaf1#metadata\">\n<head>\n<metadata>\n<ttm:title>\nTwitter Subtitles\n</ttm:title>\n</metadata>\n<styling>\n<style id=\"s0\" tts:backgroundColor=\"black\" tts:fontStyle=\"normal\" tts:fontSize=\"16\" tts:fontFamily=\"sansSerif\" tts:color=\"white\" />\n</styling>\n</head>\n<body tts:textAlign=\"center\" style=\"s0\">\n<div>";
$footerTT = "</div>\n</body>\n</tt>";
// if form submitted created xml
if (isset($_POST['url'])) {
// load Simplepie - rss reader
require_once('scripts/simplepie.php');
$url = $_POST['url'];
$sPg = $_POST['startPage'];
<?php
/**
* The Google Analytics Stats Widget
*
* Now using widget API available in WordPress 2.8
* @author Spiral Web Consulting
**/
class GoogleStatsWidget extends WP_Widget
{
@mhawksey
mhawksey / tw-evs.php
Created April 21, 2010 15:26
TwEVS PHP version
<?php
/*
Name: TwEVS
URI: http://www.rsc-ne-scotland.org.uk/mashe/twevs/
Description: Turn twitter into a cheap electronic voting system. Ask the audience to tweet a custom hashtag with their response (i.e. A, B or C or Yes/No etc) then run the pipe entering the hashtag (you should use a different hashtag for each question).
Author: Martin Hawksey
Author URI: http://www.rsc-ne-scotland.org.uk/mashe
Version: 1.0
*/
@mhawksey
mhawksey / gEVS.html
Created December 13, 2010 21:06
Example of using Google Spreadsheet and Visualization API as a multi question voting (clicker) system
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>gEVS Using Google Spreadsheet and Visualization API as a voting system wrapper</title>
@mhawksey
mhawksey / cacheTweets
Created January 5, 2011 15:43
script to cache twitter timeline (modified from http://brenelz.com/blog/build-a-php-twitter-widget/)
<?php
function twitterCapture($type) {
// Set your username and password here
$user = 'rsc_ne_scotland'; // Twitter Username
if ($type == "json") $type .= "?callback=twitterCallback2&count=8";
$tw = curl_init("http://twitter.com/statuses/user_timeline/{$user}.$type"); //grabs the JSON format of your timelines
curl_setopt($tw,CURLOPT_TIMEOUT, 30); // Timeout (for when Twitter is down)
curl_setopt($tw,CURLOPT_RETURNTRANSFER,1); // returns
$json = curl_exec ($tw); // Executes the cURL and puts it into the varible
@mhawksey
mhawksey / contextual-related-posts.php
Created January 11, 2011 21:39
Mod of Ajay D'Souza Contextual Related Posts WordPress plugin
user2 = '';
if ($('.twitter-anywhere-tweet-box-editor').length){
// New Twitter textarea tweet entry
user1 = extractAt($('.twitter-anywhere-tweet-box-editor').val());
user2 = $('#screen-name').text().replace(/[\s\xA0]+/g,'');
} else {
if ($('.tweet.permalink-tweet').length){
// status page when logged in
user1 = $('.tweet.permalink-tweet').attr('data-screen-name');
user2 = extractAt($('.tweet-text.tweet-text-large').text());
<?php
function getCSVfromGoogle($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.rsc-ne-scotland.org.uk/mashe");
$arr = importCSV(curl_exec($ch), true);
curl_close($ch);
return $arr;
}
@mhawksey
mhawksey / ie.css
Created April 14, 2011 20:02
ie6 fix
/*
Theme Name:Child Theme for Denali
Theme URI:http://twincitiestech.com
Description:Example child theme for the Denali
Version:0.1
Template:denali
Author:TwinCitiesTech.com,Inc. */
/*
This is an example of a child theme. In you want to modify the Denali,do so by using this child theme. Learn more about child themes here:http://codex.wordpress.org/Child_Themes */
<?php
/**
* RSS2 Feed Template for displaying RSS2 Posts feed.
*
* @package WordPress
*/
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
$more = 1;
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>