Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7911952

Browse files
committed
Merge branch 'master' of github.com:coderstats/coderstats.net
2 parents 566484c + c83c7f5 commit 7911952

25 files changed

+592
-235
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Logya
1+
# site
22
archive/
33
deploy/
44
public/

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# README
22

3-
Source files for [coderstats.net](https://coderstats.net/).
3+
Source files for [coderstats.net](https://coderstats.net/).
4+
5+
# GitHub API Calls
6+
7+
* https://api.github.com/users/yaph/events/public
8+
* https://api.github.com/users/yaph/received_events/public

content/github.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: CoderStats
2+
title: CoderStats - Summary Statistics, Rankings and Repositories
3+
description: Summary statistics, rankings and repositories about public source code repositories on GitHub.
34
template: coder.html
45
created: 2017-09-22T22:12:48
56
---

content/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
noindex: 1
3+
created: 2017-09-22T22:02:05
34
url: /
4-
title: CoderStats - View Statistics for Millions of GitHub Users
5+
title: CoderStats - View Statistics for Millions of GitHub Users and Organizations
6+
description: CoderStats is a free service that displays statistics about public source code repositories for GitHub users and organizations.
57
template: front.html
6-
created: 2017-09-22T22:02:05
78
---

gulpfile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ var gulp = require('gulp'),
44
cleanCSS = require('gulp-clean-css'),
55
concat = require('gulp-concat'),
66
spawn = require('child_process').spawn,
7-
sass = require('gulp-sass');
7+
sass = require('gulp-sass')
8+
tildeImporter = require('node-sass-tilde-importer');
89

910
var do_minify = true;
1011

@@ -35,13 +36,13 @@ gulp.task('serve', function() {
3536
// Compile and copy scss styles
3637
gulp.task('scss', function () {
3738
gulp.src(paths.scss_coder)
38-
.pipe(sass().on('error', sass.logError))
39+
.pipe(sass({importer: tildeImporter}).on('error', sass.logError))
3940
.pipe(cleanCSS())
4041
.pipe(concat('coder.css'))
4142
.pipe(gulp.dest(paths.compiled));
4243

4344
return gulp.src(paths.scss_main)
44-
.pipe(sass().on('error', sass.logError))
45+
.pipe(sass({importer: tildeImporter}).on('error', sass.logError))
4546
.pipe(cleanCSS())
4647
.pipe(concat('style.css'))
4748
.pipe(gulp.dest(paths.compiled));

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coderstats.net",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "coderstats.net",
55
"keywords": [
66
"visualization",
@@ -30,6 +30,20 @@
3030
"sass": "^1.52.3"
3131
},
3232
"dependencies": {
33-
"@getbase/base": "^5.2.0"
33+
"@getbase/base": "^5.2.0",
34+
"@getbase/buttons": "^4.1.0",
35+
"@getbase/containers": "^4.2.1",
36+
"@getbase/forms": "^4.1.0",
37+
"@getbase/grid": "^4.1.0",
38+
"@getbase/layout-helpers": "^4.1.0",
39+
"@getbase/layout-spacers": "^4.1.0",
40+
"@getbase/tables": "^4.1.0",
41+
"@getbase/typography": "^4.1.1",
42+
"@getbase/typography-helpers": "^4.1.0"
43+
},
44+
"sass": {
45+
"includePaths": [
46+
"./node_modules"
47+
]
3448
}
3549
}

site.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# General settings that will be available in templates.
22
site:
3-
base_url: http://localhost:8080
4-
disqus_shortname: null
5-
author: Author Name
6-
brand: Brand Name
3+
base_url: https://coderstats.net
4+
author: Ramiro Gómez
5+
brand: CoderStats
76

87

98
# Settings that affect collections in the document index. Top-level keys of

src/js/coder.js

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,26 @@ if (document.location.hash) {
1414
document.location.href = '/';
1515
}
1616
// Set these values here because they are outside of vue's scope.
17-
document.title = `CoderStats(${github_user})`;
18-
document.getElementsByClassName('brand')[0].textContent = document.title;
17+
let short_title = `CoderStats(${github_user})`
18+
document.title = document.title.replace('CoderStats', short_title);
19+
document.getElementsByClassName('brand')[0].textContent = short_title;
1920

2021
let url_user = `https://api.github.com/users/${github_user}`,
2122
url_repos = `${url_user}/repos?sort=pushed&per_page=100`,
23+
url_issues = `https://api.github.com/search/issues?q=user:${github_user}&sort=updated&order=desc`,
2224
months_short = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
2325

2426
if (DEV) {
2527
url_user = '/data/user.json';
2628
url_repos = '/data/repos.json';
29+
url_issues = '/data/issues.json';
2730
}
2831

2932
let coder = new Vue({
3033
el: '#coder',
3134
data: {
35+
activetab: 'repos',
36+
latest_issues: null,
3237
repos: [],
3338
response: {},
3439
sort_orders: {},
@@ -56,6 +61,36 @@ let coder = new Vue({
5661
forks: function() {
5762
return this.repoRanking('forks_count');
5863
},
64+
repo_types: function() {
65+
let labels = [];
66+
let values = [];
67+
let types = {
68+
active_sources: 0,
69+
archived: 0,
70+
disabled: 0,
71+
forked: 0,
72+
mirrors: 0
73+
};
74+
for (let repo of this.repos_pushed) {
75+
if (repo.archived)
76+
types.archived++;
77+
else if (repo.disabled)
78+
types.disabled++;
79+
else if (repo.fork)
80+
types.forked++;
81+
else if (repo.mirror)
82+
types.mirrors++;
83+
else
84+
types.active_sources++;
85+
}
86+
for (let [label, value] of Object.entries(types)) {
87+
if (value > 0) {
88+
labels.push(label);
89+
values.push(value);
90+
}
91+
}
92+
return {labels: labels, values: values};
93+
},
5994
stars: function() {
6095
return this.repoRanking('stargazers_count');
6196
},
@@ -98,8 +133,18 @@ let coder = new Vue({
98133
this.rankingGraph(this.issues.slice(0, 10), 'open_issues_count', '#issues-ranking');
99134
this.rankingGraph(this.forks.slice(0, 10), 'forks_count', '#forks-ranking');
100135
this.rankingGraph(this.stars.slice(0, 10), 'stargazers_count', '#stars-ranking');
136+
137+
new Chartist.Pie('#repo-types-chart', {
138+
labels: this.repo_types.labels.map(d => d.replace('_', ' ')),
139+
series: this.repo_types.values});
101140
},
102141
methods: {
142+
fetchIssues: function() {
143+
this.$http.get(url_issues).then(response => {
144+
this.response.issues = response;
145+
this.latest_issues = response.body.items;
146+
});
147+
},
103148
fetchRepos: function() {
104149
this.$http.get(url_repos).then(response => {
105150
this.response.repos = response;
@@ -129,11 +174,17 @@ let coder = new Vue({
129174
return this.repos_pushed.filter(d => d[property])
130175
.sort((a, b) => b[property] - a[property]);
131176
},
132-
sortBy: function(key, type='number') {
177+
showTab: function(name) {
178+
this.activetab = name;
179+
if (!this.latest_issues) {
180+
this.fetchIssues();
181+
}
182+
},
183+
sortBy: function(key, type='number', property='repos') {
133184
let default_value = type === 'string' ? '' : 0;
134185
this.sort_key = key;
135186
this.sort_orders[key] = (this.sort_orders[key] || 1) * -1;
136-
this.repos.sort((a, b) => {
187+
this[property].sort((a, b) => {
137188
let x = a[key] || default_value,
138189
y = b[key] || default_value;
139190
if (type === 'string') {

src/js/events.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/js/front.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Vue.component('user-link', {
2+
props: ['login', 'avatar_url'],
3+
template: `
4+
<div class="col-1-xl col-2-l col-4-m col-12">
5+
<a v-bind:href="'/github#' + login">
6+
<img :src="avatar_url" :alt="login"/><br>
7+
<i class="fa fa-user" aria-hidden="true"></i> {{ login }}
8+
</a>
9+
</div>
10+
`
11+
});
12+
13+
14+
new Vue({
15+
el: '#active-users',
16+
data: { events: null },
17+
computed: {
18+
users: function() {
19+
return d3.nest()
20+
.key(d => d.actor.login)
21+
.entries(this.events.filter(d => d.type === 'PushEvent'))
22+
.sort((a, b) => b.values.length - a.values.length);
23+
}
24+
},
25+
created: function() {
26+
this.$http.get('https://api.github.com/events').then(response => {
27+
this.events = response.body;
28+
});
29+
}
30+
});
31+
32+
33+
new Vue({
34+
el: '#followed-users',
35+
data: {users: []},
36+
created: function () {
37+
// https://api.github.com/search/users?q=repos:%3E1&sort=followers&order=desc
38+
this.$http.get('/data/users.json').then(response => {
39+
this.users = response.body.items;
40+
});
41+
}
42+
});
43+
44+
45+
new Vue({
46+
el: '#most-repos-users',
47+
data: {users: []},
48+
created: function () {
49+
// https://api.github.com/search/users?q=repos:%3E1%20type:user&sort=repositories&order=desc
50+
this.$http.get('/data/most-repos-users.json').then(response => {
51+
this.users = response.body.items;
52+
});
53+
}
54+
});
55+
56+
57+
new Vue({
58+
el: '#earliest-users',
59+
data: {users: []},
60+
created: function () {
61+
// https://api.github.com/search/users?q=repos:%3E1%20type:user&sort=joined&order=asc
62+
this.$http.get('/data/earliest-users.json').then(response => {
63+
this.users = response.body.items;
64+
});
65+
}
66+
});

src/scss/coder.scss

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
@import 'nav';
33
@import 'table';
44

5-
#coder {
6-
background-color: $color5;
7-
}
8-
95
.box-stat {
10-
color: $color3;
6+
color: $color1;
117
font-size: .8em;
128
text-align: center;
139
width: 12em;
@@ -19,29 +15,56 @@
1915
}
2016

2117
.boxes {
22-
background-color: $color1;
18+
background-color: $color3;
2319
padding: 1em 0;
2420
}
2521

2622
.boxes .box-stat:not(:last-child) {
27-
border-right: 1px solid $color3;
23+
border-right: 1px solid $color1;
2824
margin-right: 1px;
2925
}
3026

27+
.chart {
28+
min-width: 400px;
29+
}
30+
3131
.ct-series-a .ct-bar {
32-
stroke: $color5;
32+
stroke: $color2;
33+
}
34+
35+
.ct-chart-pie {
36+
min-height: 250px;
37+
}
38+
39+
.ct-chart-pie .ct-label {
40+
fill: #222;
41+
}
42+
43+
.ct-series-a .ct-slice-pie {
44+
fill:rgb(141,211,199)
45+
}
46+
.ct-series-b .ct-slice-pie {
47+
fill:rgb(255,255,179)
48+
}
49+
.ct-series-c .ct-slice-pie {
50+
fill:rgb(190,186,218)
51+
}
52+
.ct-series-d .ct-slice-pie {
53+
fill:rgb(251,128,114)
54+
}
55+
.ct-series-e .ct-slice-pie {
56+
fill:rgb(128,177,211)
3357
}
3458

35-
.main {
36-
width: 88%;
59+
.meta {
60+
background-color: $color4;
3761
}
3862

39-
.sidebar {
40-
width: 12%;
41-
font-size: .9em;
63+
// tabs
64+
.button.active {
65+
background-color: $color3;
4266
}
4367

44-
.sidebar a {
45-
color: inherit;
46-
text-decoration: none;
68+
.content {
69+
border-top: 1px solid $color5;
4770
}

0 commit comments

Comments
 (0)