浏览代码

hello, julia. you're interesting.

inspiration to try it again: http://www.evanmiller.org/why-im-betting-on-julia.html
Lucas Stadler 12 年之前
父节点
当前提交
e094a27a58
共有 2 个文件被更改,包括 21 次插入0 次删除
  1. 二进制
      jl/created_vs_push.png
  2. 21 0
      jl/github-created-vs-push.jl

二进制
jl/created_vs_push.png


+ 21 - 0
jl/github-created-vs-push.jl

@ -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)