Skip to content

Instantly share code, notes, and snippets.

View ssx's full-sized avatar

Scott Robinson ssx

View GitHub Profile
@ssx
ssx / gist:590085
Created September 21, 2010 17:25
Twitter API Example Call
<?php
// Require all the files we need
require "../lib/EpiCurl.php";
require "../lib/EpiOAuth.php";
require "../lib/EpiTwitter.php";
// Your user tokens, these won't work as they are invalid, for more information
// on getting your own user tokens or how to register an application yourself,
// please watch http://www.youtube.com/watch?v=bg_wQEmAgaM which shows the
// whole process in detail
@ssx
ssx / gist:590104
Created September 21, 2010 17:35
Twitter API Example Response
array(33) {
["verified"]=>
bool(false)
["profile_use_background_image"]=>
bool(true)
["description"]=>
string(140) "Web,  Apple and data geek with a passion for cross source data manipulation and a love of anything open source.
I also run tweekly.fm."
["follow_request_sent"]=>
<?php
// Twitter Status Update via Oauth
// By Scott Wilcox (v0.1) http://dor.ky
require "lib/EpiCurl.php";
require "lib/EpiOAuth.php";
require "lib/EpiTwitter.php";
// You need to fetch these OAuth tokens and save them for use
// within the OAuth calls. To get these values you will need
// to create a new 'app' at http://dev.twitter.com/apps
@ssx
ssx / gist:619665
Created October 10, 2010 22:57
GeoCache GPX Example.gpx
<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak, Inc. All Rights Reserved. http://www.groundspeak.com" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">
<name>Cache Listing Generated from Geocaching.com</name>
<desc>This is an individual cache generated from Geocaching.com</desc>
<author>Account "Gb UK" From Geocaching.com</author>
<email>[email protected]</email>
<url>http://www.geocaching.com</url>
<urlname>Geocaching - High Tech Treasure Hunting</urlname>
<time>2010-10-10T22:54:31.1487819Z</time>
<keywords>cache, geocache</keywords>
<?php
// Firstly we need to load our XML file (test.gpx) into
// a resource that we can use
$xml = simplexml_load_file("test.gpx");
// Put our cache data into a easy to use variable
$data = $xml->wpt->children("http://www.groundspeak.com/cache/1/0");
// You can now do anything you wish with the data,
// like printing out the cache title and size/container
<?
$m = new Mongo();
$h = $m->user->users;
$artist = "Linkin Park";
// lastfm_band_0, lastfm_band_1 or lastfm_band_2 may contain $artist
// I need to get the number of documents where this is the case
$x = $h->find(array("lastfm_band_0" => $artist,
'$or' => array(
@ssx
ssx / verify_credentials.php
Created February 28, 2011 17:34
Single Account / Verify Credentials
<?php
// OAuth Examples: Twitter
// by Scott Wilcox <[email protected]> http://dor.ky @dordotky
// https://dor.ky/oauth-examples/twitter
//
// This script verifies that the credentials you have are actually valid.
//
// First, require the OAuth library that we're going to use to handle all of the
// OAuth dirty work.
require "../library/EpiCurl.php";
The page you requested does not exist.
The server could not complete your request.
@ssx
ssx / example_carpark.json
Created March 22, 2011 16:17
example_carpark.json
{
"generated":"Thu, 29 Dec 2011 22:26:05 +0000",
"server":"dor.ky",
"woeid":"24875484",
"locations": [
{
"id":"C07323",
"name":"Bargate Centre",
"image":"\/C07323.jpg"
},
@ssx
ssx / example_carpark_data.json
Created March 22, 2011 17:27
example_carpark_data.json
[{
"status":200,
"generated":"Thu, 29 Dec 2011 22:32:06 +0000",
"name":"Charlotte Place",
"image":"\/C07318.jpg",
"updated":"1325197800",
"age":126,
"state":"spaces",
"capacity":"144",
"used":"122",