Skip to content

Instantly share code, notes, and snippets.

@georules georules/_.md

Last active Dec 11, 2015
Embed
What would you like to do?
Tributary API
{"description":"Tributary API","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.6150630391506304,"hidepanel":false}
// https://github.com/enjalot/tributary/blob/4902fbb6cd12acdb16b084e8700ad6fee94fee90/server.js
// line 513+
//still working on this
var display = d3.select("#display")
var users_url = '/api/users';
var created_url = '/api/latest/created'
var fork_url = '/api/latest/forks'
var visits_url = '/api/latest/visits'
var most_viewed_url = '/api/most/viewed'
var most_forked_url = '/api/most/forked'
var counts_url = '/api/counts/visits'
function getdata() {
if (!tributary.apidata) {
d3.json(users_url, function(err, res) {
tributary.apidata = res;
});
}
}
display.append("input")
.attr({
id: "fetch",
type: "button",
value: "fetch"
})
.on("click", function() {
getdata();
render();
})
display.append("div").attr("id","data").classed("inlet",true)
data = display.select("#data")
data.style("width","60%").style("height","70%").style("overflow","scroll");
function render() {
display.select("#data")
.text(function(){
f = Object.keys(tributary.apidata[0])
c = tributary.apidata.length
return users_url + ": "+ JSON.stringify(c) + " objects of : "+ JSON.stringify(f);
})
}
getdata();
render();
#fetch {
margin-top: 20px;
right: 40px;
font-size:29px;
}
.inlet {
margin-left: 10px;
margin-top: 20px;
}
.inlet img {
//margin-left: 10px;
margin-top: 5px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.