Created
November 5, 2011 15:12
-
-
Save max-mapper/1341642 to your computer and use it in GitHub Desktop.
twitter publishing from ipad test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lt IE 7 ]> <html lang="en" class="ie ie6"> <![endif]--> | |
<!--[if IE 7 ]> <html lang="en" class="ie ie7"> <![endif]--> | |
<!--[if IE 8 ]> <html lang="en" class="ie ie8"> <![endif]--> | |
<!--[if IE 9 ]> <html lang="en" class="ie ie9"> <![endif]--> | |
<!--[if (gt IE 9)|!(IE)]><!--> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<!--<![endif]--> | |
<head> | |
<meta name="generator" content= | |
"HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" /> | |
<title>Mozilla Festival consumes world record amount of espresso - Metro - | |
The Boston Globe</title><!-- Methode uuid: "7fc41056-070c-11e1-b8b0-6d27e447c350" --> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
<meta name="viewport" content= | |
"width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" /> | |
<link href="http://www.bostonglobe.com/css/globe-basic.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-globals.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-masthead.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-nav.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-nav-menus.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-saved.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-main.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-footer.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<link href="http://www.bostonglobe.com/css/globe-print.css" rel="stylesheet" id="basic-css" type="text/css" /> | |
<style> | |
.article-body { | |
padding-top: 10px; | |
} | |
#t_pictures { | |
max-height: 200px; | |
clear: both; | |
} | |
#t_pictures #t_pictures-left_nav { | |
width: 45px; | |
height: 150px; | |
} | |
#t_pictures #t_pictures-content { | |
width: 600px | |
} | |
#t_pictures #t_pictures-content img.t_picture { | |
max-height: 150px; | |
border: 1px solid #EEEEEE; | |
float: left; | |
margin: 0px 3px 0px 3px; | |
} | |
#t_pictures #t_pictures-right_nav { | |
width: 45px; | |
height: 150px; | |
} | |
</style> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script type="text/javascript"> | |
/** | |
* jQuery Masonry v2.0.111015 | |
* A dynamic layout plugin for jQuery | |
* The flip-side of CSS Floats | |
* http://masonry.desandro.com | |
* | |
* Licensed under the MIT license. | |
* Copyright 2011 David DeSandro | |
*/ | |
(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()};var f=["position","height"];b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[],this.reloadItems();var d=this.element[0].style;this.originalStyle={};for(var e=0,g=f.length;e<g;e++){var h=f[e];this.originalStyle[h]=d[h]||""}this.element.css({position:"relative"}),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={};var i=b(document.createElement("div"));this.element.prepend(i),this.offset.y=Math.round(i.position().top),this.options.isRTL?(i.css({"float":"right",display:"inline-block"}),this.offset.x=Math.round(this.element.outerWidth()-i.position().left)):this.offset.x=Math.round(i.position().left),i.remove();var j=this;setTimeout(function(){j.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){j.resize()})},_init:function(a){this._getColumns(),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,c){var d,e,f,g,h,i;for(var j=0,k=a.length;j<k;j++){d=b(a[j]),e=Math.ceil(d.outerWidth(!0)/this.columnWidth),e=Math.min(e,this.cols);if(e===1)this._placeBrick(d,this.colYs);else{f=this.cols+1-e,g=[];for(i=0;i<f;i++)h=this.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);this._placeBrick(d,g)}}var l={};l.height=Math.max.apply(Math,this.colYs)-this.offset.y;if(this.options.isFitWidth){var m=0,j=this.cols;while(--j){if(this.colYs[j]!==this.offset.y)break;m++}l.width=(this.cols-m)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:l});var n=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",o=this.options.animationOptions,p;for(j=0,k=this.styleQueue.length;j<k;j++)p=this.styleQueue[j],p.$el[n](p.style,o);this.styleQueue=[],c&&c.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g={top:c};g[this.horizontalDirection]=this.columnWidth*d+this.offset.x,this.styleQueue.push({$el:a,style:g});var h=c+a.outerHeight(!0),i=this.cols+1-f;for(e=0;e<i;e++)this.colYs[d+e]=h},resize:function(){var a=this.cols;this._getColumns(),this.cols!==a&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(this.offset.y);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var c=this.element[0].style;for(var d=0,e=f.length;d<e;d++){var g=f[d];c[g]=this.originalStyle[g]}this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){function h(){--e<=0&&this.src!==f&&(setTimeout(g),d.unbind("load error",h))}function g(){a.call(b,d)}var b=this,d=b.find("img").add(b.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";e||g(),d.bind("load error",h).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src=f,this.src=a}});return b};var g=function(a){this.console&&console.error(a)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d)g("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");else{if(!b.isFunction(d[a])||a.charAt(0)==="_"){g("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)}})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery); | |
</script> | |
<script type="text/javascript"> | |
var newest; | |
$(function(){ | |
setInterval(function() { | |
$.getJSON("http://data.ic.ht/dc7af6331b56eb84e4756e040ad53d594d/_design/tweets/_view/photos?include_docs=true&descending=true&callback=?").then( | |
function(tweets) { | |
if (!newest || ( newest.id !== tweets.rows[0].id) ) { | |
$('#t_pictures-content').html('') | |
$.each(tweets.rows, function(i, tweet) { | |
try { | |
$('#t_pictures-content').append($('<img class="t_picture" src="' + tweet.doc.entities.media[0].media_url + '"/>')) | |
} catch(e) { } | |
}) | |
} | |
if (!newest) newest = tweets.rows[0]; | |
} | |
) | |
},1000) | |
}) | |
</script> | |
</head> | |
<body class="type-internal type-article section-metro"> | |
<div id="contain"> | |
<!-- Page header --> | |
<h2 class="logo-bg"><a href="/"></a></h2> | |
<h1 class="section"><a href="/metro">Metro</a></h1> | |
<div class="bg-high-value"> | |
<p><a class="bostoncom" href="http://www.boston.com"><b>Boston.com</b></a></p> | |
<div class="bg-classifieds mini-menu"> | |
<p class="title">Classifieds<i>:</i></p> | |
<ul> | |
<li><a href="http://www.boston.com/cars">Cars</a></li> | |
<li><a href="http://www.boston.com/jobs/">Jobs</a></li> | |
<li class="last"><a href="http://www.boston.com/realestate">Real | |
Estate</a></li> | |
</ul> | |
</div><!-- /end .classifieds --> | |
</div><!-- /end .bg-high-value --> | |
<p class="a11y-only"><a href= | |
"http://www.bostonglobe.com/eom/SysConfig/WebPortal/BostonGlobe/Framework/regi/final-login.jsp"> | |
Log in <i>:</i></a></p> | |
<div class="nav-primary"> | |
<form action="/search" class="search bg-search-primary" method="post"> | |
<fieldset> | |
<label for="q">Search:</label> | |
<div class="search-inputs"> | |
<div> | |
<input type="text" class="search" name="search" id="q" placeholder= | |
"Search" /> <input type="submit" class="submit" value="Go" /> | |
</div> | |
</div> | |
</fieldset> | |
</form><!-- /end form.search --> | |
<!-- root expanded --> | |
<div id="main" role="main"> | |
<!-- Left Navigation Section --> | |
<div class="article"> | |
<!-- Headline Section --> | |
<div class="header"> | |
<p class="hed-cat"></p> | |
<h1 class="main-hed">Mozilla Festival consumes world record amount of espresso</h1> | |
<h2 class="subhed"></h2> | |
</div><!-- By Line Section --> | |
<div class="byline"> | |
<p><!-- web pub date November 05, 2011 --> November 05, 2011</p> | |
</div><!-- Header Tabs Section --> | |
<ul class="article-cats"> | |
<li class="now"><a href= | |
"/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/story.html" | |
class="icon ico-doc"><b>Article</b></a></li> | |
<li><a href= | |
"/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/discuss.html" | |
class="icon ico-discuss"><b>Discuss</b></a></li> | |
</ul><!-- Big leading photo --> | |
<!-- Story tools --><!--trim: --> | |
<div class="facebook-like" data-url= | |
"http://www.bostonglobe.com/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/story.html?emtaf=aritcle"> | |
<!--facebook inject here; see README for optional parameters --> | |
</div> | |
<ul class="tools primary-tools"> | |
<!-- share tool loid: 1.0.580730423 --> | |
<li class="email"> | |
<a class="top icon ico-email" href="http://datacouch.com/edit/#/dc7af6331b56eb84e4756e040ad53d594d">E-mail</a> | |
</li> | |
<li class="share"> | |
<a class="top" href="http://twitter.com/#!/mozillafestival/status/133220437562900480">UPLOAD PHOTO FROM TWITTER</a> | |
</li> | |
<li class="save"> | |
<form class="server-saveable" action= | |
"/saved/article?next=http%3A%2F%2Fwww.bostonglobe.com%2Fmetro%2F2011%2F11%2F04%2Fred-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project%2FrhTSXmSNbSRzG9iWwHZMQO%2Fstory.html" | |
method="post"> | |
<input type="hidden" name="uuid" value= | |
"d494c9ae-0725-11e1-82cf-1d2f59900895" /> <button>Save</button> | |
</form> | |
</li><!-- total shareCounts = --> | |
<!-- Facebook shareCounts = --> | |
<!-- Twitter shareCounts = --> | |
<!-- LinkIn shareCounts = --> | |
</ul> | |
<div id="t_pictures"> | |
<div id="t_pictures-content"> | |
</div> | |
</div> | |
<div class="article-body"> | |
<!-- leading video or graphic --> | |
<!-- inside story_update.jpt --> | |
<!-- In Story Photo or Graphic Section --> | |
<!----> | |
<p>Starting this morning, buses will replace MBTA Red Line trains north of the | |
Harvard Square stop every weekend until March, with the exception of the | |
Christmas and New Year’s weekends.</p> | |
<p>The construction work means the Porter Square, Davis Square, and Alewife | |
subway stations will be shuttered Saturdays and Sundays. The station closings | |
are needed to allow T crews to make $80 million in repairs designed to keep | |
trains from derailing.</p> | |
<p>The buses will operate as frequently, if not more frequently, than trains, | |
an MBTA spokesman said.</p> | |
<div data-adname="ARTICLE" class="ad aside"></div> | |
<p id="skip-target">Construction is expected to end March 4.</p> | |
<p>Until then, riders should keep in mind the following when traveling north of | |
Harvard Square:</p> | |
<p>■ <b class="b">Harvard Square Station</b>: Outbound passengers will be | |
picked up in the upper busway of the station, while inbound passengers will be | |
dropped off in the lower busway.</p> | |
<p>■ <b class="b">Porter Square Station</b>: Outbound buses will stop on | |
Massachusetts Avenue adjacent to the subway station entrance. Inbound buses | |
will stop on Massachusetts Avenue opposite the station entrance.</p> | |
<p>■ <b class="b">Davis Station</b>: Outbound buses will stop in the | |
busway of the station. Inbound buses will stop on Holland Street, adjacent to | |
the station entrance.</p> | |
<p>■ <b class="b">Alewife Station</b>: Buses will pick up and drop off | |
passengers in the busway, berths 1 through 5.</p><!----> | |
<em><i class="i">AMANDA CEDRONE</i></em> <!-- inside story_update.jpt --> | |
</div><!-- Story tools --><!--trim: --> | |
<div class="facebook-like" data-url= | |
"http://www.bostonglobe.com/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/story.html?emtaf=aritcle"> | |
<!--facebook inject here; see README for optional parameters --> | |
</div> | |
<ul class="tools primary-tools"> | |
<!-- share tool loid: 1.0.580730423 --> | |
<li class="email"> | |
<a class="top icon ico-email" href="#">E-mail</a> | |
<div class="email-form"> | |
<h4>Share via e-mail</h4> | |
<div class="email-error"></div> | |
<form action="" method="post"> | |
<input type="hidden" id="story_url" name="story_url" value= | |
"http://www.bostonglobe.com/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/story.html" /> | |
<p><label for="email-to-primary">To</label> <input type="text" name= | |
"email-to-primary" id="email-to-primary" placeholder= | |
"Separate multiple addresses with a comma" /></p> | |
<p><label for="email-mssg-primary">Add a message</label> | |
<textarea name="email-mssg-primary" id="email-mssg-primary" maxlength= | |
"80" placeholder="80 character limit"> | |
</textarea></p> | |
<p><label for="email-from-primary">Your e-mail</label> <input type="text" | |
name="email-from-primary" id="email-from-primary" /></p><input type= | |
"submit" value="Send" class="bg-button" /> | |
</form> | |
</div><!-- /end .email-form --> | |
</li><!-- /end li.email --> | |
<!-- short URL = http://b.globe.com/tdRu68 --> | |
<li class="share"> | |
<a class="top" href="http://twitter.com/#!/mozillafestival/status/133220437562900480">TWEET A PHOTO</a> | |
</li> | |
<li class="save"> | |
<form class="server-saveable" action= | |
"/saved/article?next=http%3A%2F%2Fwww.bostonglobe.com%2Fmetro%2F2011%2F11%2F04%2Fred-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project%2FrhTSXmSNbSRzG9iWwHZMQO%2Fstory.html" | |
method="post"> | |
<input type="hidden" name="uuid" value= | |
"d494c9ae-0725-11e1-82cf-1d2f59900895" /> <button>Save</button> | |
</form> | |
</li><!-- total shareCounts = --> | |
<!-- Facebook shareCounts = --> | |
<!-- Twitter shareCounts = --> | |
<!-- LinkIn shareCounts = --> | |
</ul> | |
<ul class="article-cats"> | |
<li class="now"><a href= | |
"/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/story.html" | |
class="icon ico-doc"><b>Article</b></a></li> | |
<li><a href= | |
"/metro/2011/11/04/red-line-north-harvard-square-closed-weekends-starting-today-for-major-repair-project/rhTSXmSNbSRzG9iWwHZMQO/discuss.html" | |
class="icon ico-discuss"><b>Discuss</b></a></li> | |
</ul> | |
</div> | |
</div><!-- Page footer --> | |
<div class="lead"> | |
<h1>Learn more</h1> | |
<ul> | |
<li><a href="http://www.boston.com/bostonglobe/features/">Site features</a></li> | |
<li><a href= | |
"https://services.bostonglobe.com/order/secure/bg/mec.aspx?reason=WW101557&map=YYYYYYY&zip=&product=eGlobe"> | |
Subscribe</a></li> | |
<li><a href="/insiders">Boston Globe Insiders</a></li> | |
</ul> | |
</div> | |
<div class="ad ad-slot-c" data-adname="EXTRA"></div><!-- Tracking --> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ntwitter = require('ntwitter'), | |
request = require('request').defaults({json: true}), | |
_ = require('underscore'), | |
spawn = require('child_process').spawn | |
; | |
var globeTweets = new ntwitter({ | |
consumer_key: '', | |
consumer_secret: '', | |
access_token_key: '', | |
access_token_secret: '' | |
}); | |
var couch = "put a couchdb db url here, e.g. http://admin:pass@localhost:5984/tweets"; | |
globeTweets.stream('statuses/filter', { track: 'bostonglobe photo' }, function(stream) { | |
stream.on('data', function(tweet) { | |
if (tweet.in_reply_to_screen_name && tweet.in_reply_to_screen_name === "BostonGlobe") { | |
request({url: couch, method: "POST", body: tweet}, function(e,r,b) { | |
if (e) console.log('error', e) | |
spawn("/usr/bin/say", ["tweet tweet tweet tweet"]); | |
console.log('saved tweet', b) | |
}) | |
} | |
}); | |
console.log("listening for tweets..."); | |
}); | |
function getStatus(id, callback) { | |
request("http://api.twitter.com/1/statuses/show/" + id + ".json", function(e,r,b) { | |
callback(b) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment