Skip to content

Instantly share code, notes, and snippets.

@bulkan
Last active September 4, 2015 04:24
Show Gist options
  • Save bulkan/263172 to your computer and use it in GitHub Desktop.
Save bulkan/263172 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Queshuns</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
function refreshTweets() {
$.getJSON('/latest', {since: window.latestTweet, nt:(new Date()).getTime()},
function(data) {
$('#content').prepend(data[0]);
$('.latest').slideDown('slow', function() { $(this).removeClass('latest');});
$('#content div:gt(50)').remove();
setTimeout(refreshTweets, 10000);
});
};
$(function() {
setTimeout(refreshTweets, 10000);
});
</script>
<div id='content'>
{% for tweet in tweets %}
<div>
<h1><a href="http://twitter.com/{{ tweet.username }}/status/{{ tweet.id }}" class="more">{{ tweet.username }}</a> </h1>
<div>
<p>
<img height=45 width=48 src="{{ tweet.profile_image_url }}">
<span> {{ tweet.text }} <span>
</p>
</div>
</div>
{% endfor %}
</div>
{% if tweets %}
<script type="text/javascript">
window.latestTweet = {{ tweets.0.received_at }};
</script>
{% else %}
<script type="text/javascript">
window.latestTweet = 0;
</script>
{% endif %}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment