Skip to content

Instantly share code, notes, and snippets.

@edstenson
edstenson / TABLEexample
Created September 26, 2011 12:25
TABLE example
CREATE TABLE IF NOT EXISTS `datasiftStreamExample` (
`incID` INT NOT NULL AUTO_INCREMENT ,
`id` VARCHAR(32) NULL ,
`content` VARCHAR(1000) NULL ,
`source` VARCHAR(30) NULL ,
`username` VARCHAR(45) NULL ,
`name` VARCHAR(50) NULL ,
`type` VARCHAR(45) NULL ,
`link` VARCHAR(150) NULL ,
`created_at` VARCHAR(45) NULL ,
@edstenson
edstenson / Twitter-tag
Created September 30, 2011 11:39
Example Twitter JSON object with tag added
{
"stream": [
{
"interaction": {
"source": "twitterfeed",
"author": {
"username": "GBDataStream",
"name": "Gary Bender",
"id": 194297785,
"avatar": "http://a2.twimg.com/sticky/default_profile_images/default_profile_3_normal.png",
@edstenson
edstenson / HTTP Streaming API Response Header
Created October 12, 2011 15:47
HTTP Streaming API Response Header
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
1
821
{ "interaction": {
"source": "foursquare",
@edstenson
edstenson / HTTP Streaming API Request Header
Last active August 11, 2023 23:02
HTTP Streaming API Request Header
GET /8bc638ddff76a9c01bd6a454de03bd30 HTTP/1.1
Host: stream.datasift.com
Authorization: <username>:<api_key>
Connection: Keep-Alive
@edstenson
edstenson / dpu.json
Created October 28, 2011 13:54
DPU endpoint
{
"dpu": 0.2,
"detail": {
"contains": {
"count": 2,
"dpu": 0.2,
"targets": {
"interaction.content": {
"count": 1,
"dpu": 0.1
@edstenson
edstenson / phpexample
Created November 16, 2011 10:31
PHP Example
<?php
require '../lib/datasift.php';
require '../config.php';
date_default_timezone_set('Europe/London');
$user = new DataSift_User(USERNAME, API_KEY);
$def = $user->createDefinition(twitter.text contains "coffee" AND
twitter.place.country exists');
try {
@edstenson
edstenson / retweet_example
Created November 16, 2011 11:49
Retweet Example
{
"interaction": {
"source": "web",
"author": {
"username": "ishabellaw",
"name": "IZΔBELLΔ☺ ",
"id": 159438737,
"avatar": "http://a0.twimg.com/profile_images/1610359102/10_normal.jpg",
"link": "http://twitter.com/ishabellaw"
},
@edstenson
edstenson / retweetexample.json
Created November 17, 2011 14:29
Retweet Example
{
"interaction": {
"source": "Flipboard",
"author": {
"username": "nik",
"name": "Nick Halstead",
"id": 3364401,
"avatar": "http://a3.twimg.com/profile_images/1681240315/nick2png_normal.png",
"link": "http://twitter.com/nik"
},
@edstenson
edstenson / gist:1496963
Created December 19, 2011 12:16
Tweet with metadata "football"
{
"interaction": {
"source": "TweetDeck",
"author": {
"username": "stewarttownsend",
"name": "Stewart Townsend",
"id": 14065694,
"avatar": "http://a2.twimg.com/profile_images/1302306721/twitterpic_normal.jpg",
"link": "http://twitter.com/stewarttownsend"
},
@edstenson
edstenson / timezones.txt
Created December 20, 2011 10:35
Timezones
Abu Dhabi
Adelaide
Alaska
Almaty
Amsterdam
Arizona
Astana
Athens
Atlantic Time (Canada)
Auckland