SlideShare a Scribd company logo
1 of 46
Download to read offline
TwitterLib.js
What is it?
Why?
http://github.com/remy/twitterlib
Examples
Features
Features

•Consistent interface & data
 structure
•Support for custom APIs
•Automatic paging
•Included utilities:
 •ify, render, time
API
timeline   status
favs       search
list
<script src="twitterlib.js"></script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.timeline('rem', function (data) {




});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.timeline('rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(data[i].text);
  }



});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.timeline('rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }



});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.timeline('rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }

  tweets.innerHTML = html.join('');
});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.status('rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }

  tweets.innerHTML = html.join('');
});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.favs('rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }

  tweets.innerHTML = html.join('');
});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.list('rem/local', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }

  tweets.innerHTML = html.join('');
});
</script>
<script src="twitterlib.js"></script>
<script>
var tweets = document.getElementById('tweets');
twitterlib.search('@rem', function (data) {
  var html = [];
  for (var i = 0; i < data.length; i++) {
    html.push(twitterlib.render(data[i]));
  }

  tweets.innerHTML = html.join('');
});
</script>
Options
Options

       twitterlib.timeline('rem', fn);

twitterlib.timeline('rem', {/*options*/}, fn);
Options

 • page: 1
 • limit: 200
 • since_id: 1
 • filter: 'foo'
Options
   twitterlib.timeline(
      'rem',
      {
         since_id: 123,
         filter: 'foo'
      },
      fn
   );
Filter
Filter
 foo
Filter
 foo
 foo bar   (foo and bar)
Filter
 foo
 foo bar      (foo and bar)
 foo OR bar
Filter
 foo
 foo bar      (foo and bar)
 foo OR bar
 "foo bar"    (atomic string)
Filter
 foo
 foo bar      (foo and bar)
 foo OR bar
 "foo bar"    (atomic string)
 foo -bar     (foo, not bar)
Filter
 foo
 foo bar      (foo and bar)
 foo OR bar
 "foo bar"    (atomic string)
 foo -bar     (foo, not bar)
 from:rem foo
Filter
 foo
 foo bar      (foo and bar)
 foo OR bar
 "foo bar"    (atomic string)
 foo -bar     (foo, not bar)
 from:rem foo
 to:rem foo
Utilities
Utilities


.custom(name, url)
Utilities

twitterlib.custom('dm',
  '/tweets?page=%page%&type=dm');

twitterlib.dm(callback);
Utilities


.next()
Utilities

var html = [];
twitterlib.timeline('rem', {limit: 5}, function(tweets){
   for (var i = 0; i < tweets.length; i++) {
     html.push(this.render(tweets[i]));
   }
})
Utilities

var html = [];
twitterlib.timeline('rem', {limit: 5}, function(tweets){
  for (var i = 0; i < tweets.length; i++) {
    html.push(this.render(tweets[i]));
  }
}).next();
Utilities


.render(tweet)
Utilities


.ify.clean(text)
Utilities
List of Twitter developers in the @WiredUK photo: @nuxnix/uk-
twitterati #devnest: http://www.wired.co.uk/wired-magazine/
archive/2009/12/start/wired%27s-guide-to-the-uk-twitterati.aspx




List of Twitter developers in the @WiredUK
photo: @nuxnix/uk-twitterati #devnest:
http://www.wired.co.uk/w...
Utilities


.time.relative(t)
Utilities
Fri Jan 08 15:44:49 +0000 2010




 20 minutes ago
Photos by Balakov




Enjoy.
@rem
http://j.mp/dnfeb

More Related Content

What's hot

What's hot (9)

Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017Simple ETL in python 3.5+ with Bonobo - PyParis 2017
Simple ETL in python 3.5+ with Bonobo - PyParis 2017
 
Python - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave ParkPython - Getting to the Essence - Points.com - Dave Park
Python - Getting to the Essence - Points.com - Dave Park
 
Exploring slides
Exploring slidesExploring slides
Exploring slides
 
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+EuroPython 2017 - Bonono - Simple ETL in python 3.5+
EuroPython 2017 - Bonono - Simple ETL in python 3.5+
 
Command line arguments that make you smile
Command line arguments that make you smileCommand line arguments that make you smile
Command line arguments that make you smile
 
Javascript Primer
Javascript PrimerJavascript Primer
Javascript Primer
 
Recognize Godzilla
Recognize GodzillaRecognize Godzilla
Recognize Godzilla
 
ProgrammingwithGOLang
ProgrammingwithGOLangProgrammingwithGOLang
ProgrammingwithGOLang
 
The Ring programming language version 1.6 book - Part 49 of 189
The Ring programming language version 1.6 book - Part 49 of 189The Ring programming language version 1.6 book - Part 49 of 189
The Ring programming language version 1.6 book - Part 49 of 189
 

Viewers also liked (6)

Lecture Notes Focuss Info Workshop Ghana Kwami Ahiabenu Ii
Lecture Notes Focuss Info Workshop Ghana  Kwami Ahiabenu IiLecture Notes Focuss Info Workshop Ghana  Kwami Ahiabenu Ii
Lecture Notes Focuss Info Workshop Ghana Kwami Ahiabenu Ii
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
Yearning jQuery
Yearning jQueryYearning jQuery
Yearning jQuery
 
Jamie
JamieJamie
Jamie
 
Gareth
GarethGareth
Gareth
 
Danielle
DanielleDanielle
Danielle
 

Similar to TwitterLib.js

PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
Patrick Allaert
 
Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudrey
Audrey Lim
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
Justin Cataldo
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
Peter Hilton
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 

Similar to TwitterLib.js (20)

Finding Clojure
Finding ClojureFinding Clojure
Finding Clojure
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Tornado
TornadoTornado
Tornado
 
YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기
 
SmokeTests
SmokeTestsSmokeTests
SmokeTests
 
Mining Georeferenced Data
Mining Georeferenced DataMining Georeferenced Data
Mining Georeferenced Data
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
Golang slidesaudrey
Golang slidesaudreyGolang slidesaudrey
Golang slidesaudrey
 
Django tech-talk
Django tech-talkDjango tech-talk
Django tech-talk
 
TwitterKitではじめる OAuthスピードクッキング
TwitterKitではじめる OAuthスピードクッキングTwitterKitではじめる OAuthスピードクッキング
TwitterKitではじめる OAuthスピードクッキング
 
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
 
Api
ApiApi
Api
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
 
Ti.developers.meeting
Ti.developers.meetingTi.developers.meeting
Ti.developers.meeting
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Azure F#unctions
Azure F#unctionsAzure F#unctions
Azure F#unctions
 
Let's read code: the python-requests library
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests library
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-MechanizePerformance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
 

More from Remy Sharp

Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
Remy Sharp
 
HTML5: huh, what is it good for?
HTML5: huh, what is it good for?HTML5: huh, what is it good for?
HTML5: huh, what is it good for?
Remy Sharp
 

More from Remy Sharp (20)

HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Forget the Web
Forget the WebForget the Web
Forget the Web
 
Interaction Implementation
Interaction ImplementationInteraction Implementation
Interaction Implementation
 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
 
HTML5: huh, what is it good for?
HTML5: huh, what is it good for?HTML5: huh, what is it good for?
HTML5: huh, what is it good for?
 
Developing for Mobile
Developing for MobileDeveloping for Mobile
Developing for Mobile
 
Browsers with Wings
Browsers with WingsBrowsers with Wings
Browsers with Wings
 
Webapps without the web
Webapps without the webWebapps without the web
Webapps without the web
 
HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?HTML5: friend or foe (to Flash)?
HTML5: friend or foe (to Flash)?
 
codebits 2009 HTML5 JS APIs
codebits 2009 HTML5 JS APIscodebits 2009 HTML5 JS APIs
codebits 2009 HTML5 JS APIs
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 
iPhone Appleless Apps
iPhone Appleless AppsiPhone Appleless Apps
iPhone Appleless Apps
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
Write Less Do More
Write Less Do MoreWrite Less Do More
Write Less Do More
 
HTML5 & Friends
HTML5 & FriendsHTML5 & Friends
HTML5 & Friends
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
 
jQuery Loves Developers - SWDC2009
jQuery Loves Developers - SWDC2009jQuery Loves Developers - SWDC2009
jQuery Loves Developers - SWDC2009
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

TwitterLib.js