mirror of
https://github.com/resume/resume.github.com.git
synced 2025-12-30 15:49:30 -06:00
added language statistics (+ indentation and code formatting)
This commit is contained in:
@@ -6,8 +6,9 @@ var urlParams = {};
|
||||
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
|
||||
q = window.location.search.substring(1);
|
||||
|
||||
while (e = r.exec(q))
|
||||
while (e = r.exec(q)) {
|
||||
urlParams[0] = d(e[1]);
|
||||
}
|
||||
})();
|
||||
|
||||
var username;
|
||||
@@ -26,7 +27,7 @@ $(document).ready(function() {
|
||||
} catch (e) {
|
||||
/*fail silently*/
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var error = function() {
|
||||
@@ -54,8 +55,8 @@ var home = function() {
|
||||
var run = function() {
|
||||
|
||||
var gh_user = gh.user(username);
|
||||
var itemCount = 0, maxItems = 5;
|
||||
|
||||
var itemCount = 0, maxItems = 5, maxLanguages = 5;
|
||||
|
||||
var res = gh_user.show(function(data) {
|
||||
gh_user.repos(function(data) {
|
||||
repos = data;
|
||||
@@ -77,7 +78,7 @@ var run = function() {
|
||||
}
|
||||
|
||||
var view = {
|
||||
name: name,
|
||||
name: name,
|
||||
email: data.user.email,
|
||||
created_at: data.user.created_at,
|
||||
location: data.user.location,
|
||||
@@ -108,9 +109,17 @@ var run = function() {
|
||||
var repos = data.repositories;
|
||||
|
||||
var sorted = [];
|
||||
var languages = [];
|
||||
var languages = {};
|
||||
|
||||
repos.forEach(function(elm, i, arr) {
|
||||
if (arr[i].language) {
|
||||
if (arr[i].language in languages) {
|
||||
languages[arr[i].language]++;
|
||||
} else {
|
||||
languages[arr[i].language] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (arr[i].fork !== false) {
|
||||
return;
|
||||
}
|
||||
@@ -118,19 +127,43 @@ var run = function() {
|
||||
var popularity = arr[i].watchers + arr[i].forks;
|
||||
sorted.push({position: i, popularity: popularity, info: arr[i]});
|
||||
});
|
||||
|
||||
|
||||
function sortByPopularity(a, b) {
|
||||
return b.popularity - a.popularity;
|
||||
};
|
||||
|
||||
sorted.sort(sortByPopularity);
|
||||
|
||||
|
||||
function sortLanguages(languages, limit) {
|
||||
var sorted_languages = [];
|
||||
for (var lang in languages) {
|
||||
if (typeof(lang) !== "string") {
|
||||
continue;
|
||||
}
|
||||
sorted_languages.push({
|
||||
name: lang,
|
||||
popularity: languages[lang],
|
||||
toString: function() {
|
||||
return '<a href="https://github.com/languages/' + this.name + '">' + this.name + '</a>';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (limit) {
|
||||
sorted_languages = sorted_languages.slice(0, limit);
|
||||
}
|
||||
return sorted_languages.sort(sortByPopularity);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'views/job.html',
|
||||
dataType: 'html',
|
||||
success: function(response) {
|
||||
var now = new Date().getFullYear();
|
||||
|
||||
if (languages) {
|
||||
$('#languages').html('I mostly program in ' + sortLanguages(languages, maxLanguages).join(', ') + '.');
|
||||
}
|
||||
|
||||
if (sorted.length > 0) {
|
||||
$('#jobs').html('');
|
||||
itemCount = 0;
|
||||
@@ -138,7 +171,7 @@ var run = function() {
|
||||
if (itemCount >= maxItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var since = new Date(arr[index].info.created_at);
|
||||
since = since.getFullYear();
|
||||
|
||||
@@ -146,19 +179,20 @@ var run = function() {
|
||||
name: arr[index].info.name,
|
||||
since: since,
|
||||
now: now,
|
||||
language: arr[index].info.language,
|
||||
description: arr[index].info.description,
|
||||
username: username,
|
||||
watchers: arr[index].info.watchers,
|
||||
forks: arr[index].info.forks
|
||||
};
|
||||
|
||||
|
||||
if (itemCount == sorted.length - 1 || itemCount == maxItems-1) {
|
||||
view.last = 'last';
|
||||
}
|
||||
|
||||
var template = response;
|
||||
var html = Mustache.to_html(template, view);
|
||||
|
||||
|
||||
|
||||
$('#jobs').append($(html));
|
||||
++itemCount;
|
||||
@@ -200,13 +234,13 @@ var run = function() {
|
||||
login: arr[index].info.login,
|
||||
now: now
|
||||
};
|
||||
|
||||
|
||||
if (itemCount == sorted.length - 1 || itemCount == maxItems) {
|
||||
view.last = 'last';
|
||||
}
|
||||
var template = response;
|
||||
var html = Mustache.to_html(template, view);
|
||||
|
||||
|
||||
$('#orgs').append($(html));
|
||||
++itemCount;
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<h2>
|
||||
<a href="http://github.com/{{username}}/{{name}}">{{name}}</a>
|
||||
</h2>
|
||||
<h3>Creator & Owner</h3>
|
||||
<h3>{{#language}}{{language}} - {{/language}}Creator & Owner</h3>
|
||||
<h4>{{since}} - {{now}}</h4>
|
||||
<p>{{description}}.</p>
|
||||
<p>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{{#repo}}
|
||||
<h1>{{repo}}</h1>
|
||||
<hgroup>
|
||||
<h1>{{repo}}</h1>
|
||||
<h2>{{language}}</h2>
|
||||
</hgroup>
|
||||
<p>{{description}}</p>
|
||||
{{/repo}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="doc2" class="yui-t7">
|
||||
<div id="inner">
|
||||
|
||||
|
||||
<div id="hd">
|
||||
<div class="yui-gc">
|
||||
<div class="yui-u first">
|
||||
@@ -31,21 +31,21 @@
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<p class="enlarge">
|
||||
I'm a developer
|
||||
{{#location}}
|
||||
based in {{location}}
|
||||
{{/location}}
|
||||
with <a href="https://github.com/{{{username}}}">{{repos}} public {{plural}}</a>.
|
||||
I've been using github.com since {{since}}
|
||||
{{#blog}}
|
||||
and sometimes I blog at <a href="" id="myblog" title="my blog">{{blog}}</a>
|
||||
{{/blog}}
|
||||
I'm a developer
|
||||
{{#location}}
|
||||
based in {{location}}
|
||||
{{/location}}
|
||||
with <a href="https://github.com/{{{username}}}">{{repos}} public {{plural}}</a>.
|
||||
I've been using github.com since {{since}}
|
||||
{{#blog}}
|
||||
and sometimes I blog at <a href="" id="myblog" title="my blog">{{blog}}</a>.
|
||||
{{/blog}}
|
||||
</p>
|
||||
<p id="languages" class="enlarge"></p>
|
||||
</div>
|
||||
</div><!--// .yui-gf -->
|
||||
|
||||
|
||||
<div class="yui-gf">
|
||||
<div class="yui-gf">
|
||||
<div class="yui-u first">
|
||||
<h2>My Popular Repositories</h2>
|
||||
</div><!--// .yui-u -->
|
||||
@@ -54,7 +54,8 @@
|
||||
<span>Loading information...</span><img src="images/loader.gif" />
|
||||
</div><!--// .yui-u -->
|
||||
</div><!--// .yui-gf -->
|
||||
<div class="yui-gf" id="organizations">
|
||||
|
||||
<div class="yui-gf" id="organizations">
|
||||
<div class="yui-u first">
|
||||
<h2>My Organizations</h2>
|
||||
</div><!--// .yui-u -->
|
||||
@@ -64,17 +65,16 @@
|
||||
</div><!--// .yui-u -->
|
||||
</div><!--// .yui-gf -->
|
||||
|
||||
|
||||
<div class="yui-gf last">
|
||||
<div class="yui-u first">
|
||||
<h2>About This Résumé</h2>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<p class="enlarge">
|
||||
This résumé is generated automatically using information from my github account. The repositories are
|
||||
ordered by popularity based on a very simple popularity heuristic that defines the popularity of a repository
|
||||
by its sum of watchers and forks. Do not hesitate to visit <a href="https://github.com/{{{username}}}" title="My Github page">my github page</a>
|
||||
for more information about my repositories and work.
|
||||
This résumé is generated automatically using information from my github account. The repositories are
|
||||
ordered by popularity based on a very simple popularity heuristic that defines the popularity of a repository
|
||||
by its sum of watchers and forks. Do not hesitate to visit <a href="https://github.com/{{{username}}}" title="My Github page">my github page</a>
|
||||
for more information about my repositories and work.
|
||||
</p>
|
||||
</div>
|
||||
</div><!--// .yui-gf -->
|
||||
@@ -88,7 +88,6 @@
|
||||
|
||||
</div><!-- // inner -->
|
||||
|
||||
|
||||
</div><!--// doc -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
Reference in New Issue
Block a user