Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.

Commit 870758a

Browse files
authored
Fixed Issues and added a UI
1 parent 39ffee2 commit 870758a

File tree

19 files changed

+632
-598
lines changed

19 files changed

+632
-598
lines changed

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://i.imgur.com/eA6clZr.png">
22

3-
# Gitfolio [![Tweet](https://img.shields.io/twitter/url/https/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=personal%20website%20and%20a%20blog%20for%20every%20github%20user%20@imfunnieee%20&url=https://github.com/imfunniee/gitfolio) ![GitHub release](https://img.shields.io/github/release/imfunniee/gitfolio.svg?style=popout-square) ![npm](https://img.shields.io/npm/dm/gitfolio.svg?style=popout-square) ![GitHub top language](https://img.shields.io/github/languages/top/imfunniee/gitfolio.svg?style=popout-square) ![GitHub last commit](https://img.shields.io/github/last-commit/imfunniee/gitfolio.svg?style=popout-square) ![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg?style=popout-square)
3+
# Gitfolio [![Tweet](https://img.shields.io/twitter/url/https/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=personal%20website%20and%20a%20blog%20for%20every%20github%20user%20@imfunnieee%20&url=https://github.com/imfunniee/gitfolio) ![GitHub release](https://img.shields.io/github/release/imfunniee/gitfolio.svg?style=popout-square) ![npm](https://img.shields.io/npm/dm/gitfolio.svg?style=popout-square) ![GitHub top language](https://img.shields.io/github/languages/top/imfunniee/gitfolio.svg?style=popout-square) ![GitHub last commit](https://img.shields.io/github/last-commit/imfunniee/gitfolio.svg?style=popout-square) ![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg?style=popout-square) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
44

55
### personal website + blog for every github user
66

api.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const got = require("got");
2+
3+
/**
4+
* The defaults here are the same as the API
5+
* @see https://developer.github.com/v3/repos/#list-user-repositories
6+
* @param {string} username
7+
* @param {Object} opts
8+
* @param {('all' | 'owner' | 'member')[]} [opts.types]
9+
* @param {'created' | 'updated' | 'pushed' | 'full_name' | 'star'} [opts.sort]
10+
* @param {'desc' | 'asc'} [opts.order]
11+
*/
12+
async function getRepos(username, opts = {}) {
13+
let tempRepos;
14+
let page = 1;
15+
let repos = [];
16+
17+
const sort = opts.sort;
18+
const order = opts.order || (sort === "full_name" ? "asc" : "desc");
19+
const types = opts.types || [];
20+
let type = "all";
21+
22+
if (
23+
types.includes("all") ||
24+
(types.includes("owner") && types.includes("member"))
25+
) {
26+
type = "all";
27+
} else if (types.includes("member")) {
28+
type = "member";
29+
}
30+
31+
do {
32+
let requestUrl = `https://api.github.com/users/${username}/repos?per_page=100&page=${page++}&type=${type}`;
33+
if (sort && sort !== "star") {
34+
requestUrl += `&sort=${sort}&direction=${order}`;
35+
}
36+
tempRepos = await got(requestUrl);
37+
tempRepos = JSON.parse(tempRepos.body);
38+
repos = repos.concat(tempRepos);
39+
} while (tempRepos.length == 100);
40+
41+
if (sort == "star") {
42+
repos = repos.sort(function(a, b) {
43+
if (order == "desc") {
44+
return b.stargazers_count - a.stargazers_count;
45+
} else {
46+
return a.stargazers_count - b.stargazers_count;
47+
}
48+
});
49+
}
50+
51+
return repos;
52+
}
53+
54+
/**
55+
* @see https://developer.github.com/v3/users/#get-a-single-user
56+
* @param {string} username
57+
*/
58+
async function getUser(username) {
59+
const res = await got(`https://api.github.com/users/${username}`);
60+
return JSON.parse(res.body);
61+
}
62+
63+
module.exports = {
64+
getRepos,
65+
getUser
66+
};

assets/blog/blog.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[]
1+
[]

assets/blog/blogTemplate.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ <h2 id="blog_sub_title">
103103
icon.setAttribute("href", user[0].userimg);
104104
icon.setAttribute("type", "image/png");
105105
document.getElementsByTagName("head")[0].appendChild(icon);
106-
document.getElementById("profile_img_blog").style.background = `url('${
107-
user[0].userimg
108-
}') center center`;
106+
document.getElementById(
107+
"profile_img_blog"
108+
).style.background = `url('${user[0].userimg}') center center`;
109109
document.getElementById(
110110
"username_blog"
111111
).innerHTML = `<span style="display:${

0 commit comments

Comments
 (0)