1 2$(document).ready(function() { 3 4 // set your twitter id 5 var user = 'campuscyclery'; 6 7 // using jquery built in get json method with twitter api, return only one result 8 $.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name=' + user + '&count=1&callback=?', function(data) { 9 10 // result returned 11 var tweet = data[0].text; 12 13 // process links and reply 14 tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) { 15 return '<a href="'+url+'" target="_blank">'+url+'</a>'; 16 }).replace(/B@([_a-z0-9]+)/ig, function(reply) { 17 return reply.charAt(0)+'<a href="http://twitter.com/%27+reply.substring%281%29+%27">'+reply.substring(1)+'</a>'; 18 }); 19 20 // output the result 21 $("#lasttweet").html(tweet); 22 }); 23 24});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.