Skip to content

Instantly share code, notes, and snippets.

@zackfern
Created April 22, 2013 20:17
Show Gist options
  • Save zackfern/5438140 to your computer and use it in GitHub Desktop.
Save zackfern/5438140 to your computer and use it in GitHub Desktop.
Display your latest Preserve bookmarks on your personal website!
$(function(){
// Loading the latest profile JSON from Preserve.
$.getJSON('http://preserve.io/u/zackfern.json', function(data){
var items = [];
// How many bookmarks are we going to display?
var limit = 4;
var bookmarks = 0;
$.each(data.user.bookmarks, function(key, bookmark){
if(bookmarks > limit) {
return false;
}
else {
bookmarks = bookmarks + 1;
items.push('<li><a href="'+ bookmark.url +'">'+ bookmark.title +'</a></li>')
}
});
$('#bookmarks').html(items.join(''));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment