|
|
@ -0,0 +1,21 @@
|
|
|
1
|
using HTTPClient
|
|
|
2
|
using JSON
|
|
|
3
|
using DataFrames
|
|
|
4
|
using Gadfly
|
|
|
5
|
|
|
|
6
|
github_get(path) = takebuf_string(get(string("https://api.github.com", path), headers=[("User-Agent", "Julia-Experiment")]).body)
|
|
|
7
|
|
|
|
8
|
function toDataFrame(dicts, keys = keys(dicts[1]))
|
|
|
9
|
df = DataFrame()
|
|
|
10
|
for k in keys
|
|
|
11
|
df[k] = map(d -> d[k], dicts)
|
|
|
12
|
end
|
|
|
13
|
return df
|
|
|
14
|
end
|
|
|
15
|
|
|
|
16
|
repos_str = github_get("/users/mbostock/repos")
|
|
|
17
|
repos = JSON.parse(repos_str)
|
|
|
18
|
repos_df = toDataFrame(repos, filter(k -> search(k, "url") == 0:-1, keys(repos[1])))
|
|
|
19
|
|
|
|
20
|
p = plot(toDataFrame(repos), y = "pushed_at", x = "created_at", label = "name", Geom.point, Geom.label(;hide_overlaps=false))
|
|
|
21
|
draw(PNG("created_vs_push.png", 9inch, 9inch/golden), p)
|