Skip to content

Instantly share code, notes, and snippets.

@makenosound
Forked from liquorice/gist:1041979
Created June 25, 2011 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makenosound/1046087 to your computer and use it in GitHub Desktop.
Save makenosound/1046087 to your computer and use it in GitHub Desktop.
bare bones method for grabbing and updating a users latest tweet (with no error handling whatsoever)
$.ajax({
url: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someonesplendid',
dataType: 'jsonp',
success: function(data) {
var tweet = data[0].text;
tweet = tweet.replace(/(http\:\/\/[A-Za-z0-9\.\/_]+)/g, '<a href="$1">$1</a>');
tweet = tweet.replace(/@([a-zA-Z0-9_]+)/g, '<a href="http://twitter.com/$1">@$1</a>');
$('#tweet').html(tweet);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment