Public
Edited
Jun 13, 2023
Paused
60 forks
14 stars
Insert cell
Insert cell
repo = "observablehq/plot"
Insert cell
issues = fetchGithub(`/repos/${repo}/issues`, {per_page: 50})
Insert cell
Inputs.table(issues, {
layout: "auto",
columns: ["html_url", "title", "user", "comments", "created_at", "body"],
format: {
html_url: (html_url, i, data) => htl.html`<a href="${html_url}">${data[i].number}</a>`,
user: user => user.login,
created_at: created_at => d3.timeFormat("%x %X")(new Date(created_at)),
}
})
Insert cell
// toph work-in-progress
fetchGithub = async (path, params) => {
const response = (await fetch(
`https://api.github.com${path}?${new URLSearchParams(params)}`,
{headers: {
...(hasApiKey && {authorization: `token ${Secret("GITHUB_ACCESS_TOKEN")}`}),
accept: "application/vnd.github.v3+json"
}}
));
mutable rateLimit = {
remaining: +response.headers.get("X-RateLimit-Remaining"),
reset: new Date(response.headers.get("X-RateLimit-Reset") * 1000)
};
return response.json()
}
Insert cell
mutable rateLimit = null
Insert cell
hasApiKey = {
try {
Secret("GITHUB_ACCESS_TOKEN");
return true;
} catch {
return false;
}
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more