Skip to content

Instantly share code, notes, and snippets.

@nmerouze
Created January 14, 2010 18:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmerouze/277362 to your computer and use it in GitHub Desktop.
Save nmerouze/277362 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function displayTweets(data) {
$("#loading").remove();
$.each(data.results, function(i, item) {
$("#tweets").append($("<li/>").text(item.text));
});
}
$(function() {
$("#tweets").before($("<div id='loading'/>").text("Loading..."));
$.getJSON("http://search.twitter.com/search.json?q=from:nmerouze&rpp=5&callback=?", function(data) {
displayTweets(data);
});
});
</script>
</head>
<body>
<ul id="tweets"></ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function displayTweets(data) {
$("#loading").remove();
$.each(data.results, function(i, item) {
$("#tweets").append($("<li/>").text(item.text));
});
}
$(function() {
$.getJSON("http://search.twitter.com/search.json?q=from:nmerouze&rpp=5&callback=?", function(data) {
displayTweets(data);
localStorage.setItem("tweets", JSON.stringify(data));
});
});
</script>
</head>
<body>
<ul id="tweets"></ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function displayTweets(data) {
$("#loading").remove();
$("#tweets").children().remove();
$.each(data.results, function(i, item) {
$("#tweets").append($("<li/>").text(item.text));
});
}
$(function() {
$("#tweets").before($("<div id='loading'/>").text("Loading..."));
var tweets = localStorage.getItem("tweets");
if (tweets != null) displayTweets(JSON.parse(tweets));
$.getJSON("http://search.twitter.com/search.json?q=from:nmerouze&rpp=5&callback=?", function(data) {
displayTweets(data);
localStorage.setItem("tweets", JSON.stringify(data));
});
});
</script>
</head>
<body>
<ul id="tweets"></ul>
<button onclick="javascript:localStorage.clear();">Clear localStorage</button>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="modernizr.js" type="text/javascript"></script>
<script type="text/javascript">
function displayTweets(data) {
$("#loading").remove();
$("#tweets").children().remove();
$.each(data.results, function(i, item) {
$("#tweets").append($("<li/>").text(item.text));
});
}
$(function() {
$("#tweets").before($("<div id='loading'/>").text("Loading..."));
if (Modernizr.localstorage) {
var tweets = localStorage.getItem("tweets");
if (tweets != null) displayTweets(JSON.parse(tweets));
}
$.getJSON("http://search.twitter.com/search.json?q=from:nmerouze&rpp=5&callback=?", function(data) {
displayTweets(data);
if (Modernizr.localstorage) localStorage.setItem("tweets", JSON.stringify(data));
});
});
</script>
</head>
<body>
<ul id="tweets"></ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment