Skip to content

Instantly share code, notes, and snippets.

@erikhazzard
Forked from enjalot/_.md
Created January 22, 2013 07:00
Show Gist options
  • Save erikhazzard/4592693 to your computer and use it in GitHub Desktop.
Save erikhazzard/4592693 to your computer and use it in GitHub Desktop.
Tributary Inlet Leaderboard With more stats
{"description":"Tributary Inlet Leaderboard With more stats","endpoint":"","display":"html","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"tab":"edit","display_percent":0.41525243309002435,"hidepanel":false}
var display = d3.select("#display")
.style("overflow", "scroll");
//grab the users
function getUsers() {
var users_url = '/api/users/visits/4/-1';
d3.json(users_url, function(err, res) {
render(res);
})
}
getUsers();
function render(userList) {
var usersSel = display.selectAll("li.user")
.data(userList)//, function(d) { return d.id });
var users = usersSel
.enter()
.append("li")
.classed("user", true)
usersSel
.text(function(d) {
return d.login;
});
users.append("img")
usersSel.select("img")
.attr({
src: function(d) {
return d.avatar_url;
},
width: function(d, i) {
return 16;
},
height: function(d, i) {
return 16;
}
});
};
#fetch {
position:relative;
margin-top: 20px;
right: 40px;
font-size:29px;
float:right;
}
#sort {
position:relative;
top: 60px;
float: right;
width: 100px;
height: 100px;
text-align: right;
}
.inlet {
margin-left: 10px;
margin-top: 20px;
}
.inlet img {
margin-right: 10px;
// margin-top: 5px;
}
.inlet .user, .inlet .rank {
display: inline;
}
.inlet .rank {
margin-right: 10px;
font-size: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment