Skip to content

Commit

Permalink
language
Browse files Browse the repository at this point in the history
  • Loading branch information
hit9 committed Feb 17, 2013
1 parent 567bcbd commit e09edf2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 9 deletions.
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
percentage of language
repositories
followers and folloing
contact me!
summary of forks,repos,commits and issues
loading!
Expand Down
25 changes: 22 additions & 3 deletions coffee/ghresume.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,20 @@ $.getJSON(api_url+username+"/repos?type=owner",
# sort repo by its watchers_count
res.sort(
(a, b)->
b.watchers_count-a.watchers_count
ap = a.watchers_count+a.forks_count
bp = b.watchers_count+b.forks_count
bp-ap
)
# append repos to repolist
for repo in res[0...5]
# home page
homepage = ""
if repo.homepage
homepage = "<a href=\"" + repo.homepage + "\" ><i class=\"icon-home icon-white\" ></i></a>"

language = ""
if repo.language
language = "<span id=\"language\"> ("+repo.language+")</span>"
$("#repolist").append("
<li style=\"display: list-item;\">
<ul class=\"repo-stats\">
Expand All @@ -57,10 +63,23 @@ $.getJSON(api_url+username+"/repos?type=owner",
</ul>
<h3>
<a href=\"https://github.com/"+username+"/"+repo.name+"\">
"+repo.name+"
"+repo.name+language+"
</a>
</h3>
<p id=\"description\">"+homepage+"&nbsp; "+repo.description+"</p>
<p id=\"description\">"+homepage+"&nbsp;"+repo.description+"</p>
</li>
")
# caculate total size and percentage of codes
lang = {}
size = 0

for repo in res
if repo.language
if !lang[repo.language]
lang[repo.language] = 0
lang[repo.language] += 1
size += 1

for l, s of lang
$("#gh-data").append("<p>" + l + ":"+ s/size + "</p>")
)
5 changes: 5 additions & 0 deletions css/ghresume.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ h2{
font-style: italic;
}

h3>a>span#language{
color:#999999;
font-style: italic;
font-size:56%;
}

ul#repolist{
float:left;
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ <h2>follower</h2>
</div>
</div>
<div class="container" id="gh-data">
Skills anlysis here . coming soon
<h2>Skills</h2>
<hr>
</div>
<div class="container" id="repos">
<h2>Popular Repositories</h2>
Expand Down
31 changes: 27 additions & 4 deletions js/ghresume.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,42 @@
});

$.getJSON(api_url + username + "/repos?type=owner", function(res) {
var homepage, repo, _i, _len, _ref, _results;
var homepage, l, lang, language, repo, s, size, _i, _j, _len, _len1, _ref, _results;
res.sort(function(a, b) {
return b.watchers_count - a.watchers_count;
var ap, bp;
ap = a.watchers_count + a.forks_count;
bp = b.watchers_count + b.forks_count;
return bp - ap;
});
_ref = res.slice(0, 5);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
repo = _ref[_i];
homepage = "";
if (repo.homepage) {
homepage = "<a href=\"" + repo.homepage + "\" ><i class=\"icon-home icon-white\" ></i></a>";
}
_results.push($("#repolist").append(" <li style=\"display: list-item;\"> <ul class=\"repo-stats\"> <li class=\"stars\"> <i class=\"icon-star icon-white\"></i>" + repo.watchers_count + " </li> <li class=\"forks\"> <i class=\"icon-share-alt icon-white\"></i> " + repo.forks_count + " </li> <li class=\"created_time\"> <i class=\"icon-time icon-white\"></i>" + repo.created_at.substring(0, 10) + " </li> </ul> <h3> <a href=\"https://github.com/" + username + "/" + repo.name + "\"> " + repo.name + " </a> </h3> <p id=\"description\">" + homepage + "&nbsp; " + repo.description + "</p> </li> "));
language = "";
if (repo.language) {
language = "<span id=\"language\"> (" + repo.language + ")</span>";
}
$("#repolist").append(" <li style=\"display: list-item;\"> <ul class=\"repo-stats\"> <li class=\"stars\"> <i class=\"icon-star icon-white\"></i>" + repo.watchers_count + " </li> <li class=\"forks\"> <i class=\"icon-share-alt icon-white\"></i> " + repo.forks_count + " </li> <li class=\"created_time\"> <i class=\"icon-time icon-white\"></i>" + repo.created_at.substring(0, 10) + " </li> </ul> <h3> <a href=\"https://github.com/" + username + "/" + repo.name + "\"> " + repo.name + language + " </a> </h3> <p id=\"description\">" + homepage + "&nbsp;" + repo.description + "</p> </li> ");
}
lang = {};
size = 0;
for (_j = 0, _len1 = res.length; _j < _len1; _j++) {
repo = res[_j];
if (repo.language) {
if (!lang[repo.language]) {
lang[repo.language] = 0;
}
lang[repo.language] += 1;
}
size += 1;
}
_results = [];
for (l in lang) {
s = lang[l];
_results.push($("#gh-data").append("<p>" + l + ":" + s / size + "</p>"));
}
return _results;
});
Expand Down

0 comments on commit e09edf2

Please sign in to comment.