Skip to content

Commit

Permalink
Update App
Browse files Browse the repository at this point in the history
  • Loading branch information
gayankuruppu committed Dec 9, 2019
1 parent ddccc15 commit 0587a3e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 48 deletions.
4 changes: 2 additions & 2 deletions client/public/index.html
Expand Up @@ -6,7 +6,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Check your rank in GitHub! Get the list of most active users in GitHub by country | Updates daily | See your daily contribution to the open-source!"
content="List of most active users in GitHub | See your daily contribution to the open-source!"
/>
<link rel="apple-touch-icon" href="github-logo64.ico" />
<link rel="shortcut icon" href="github-logo64.ico" />
Expand All @@ -25,7 +25,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->

<title>GitHubStats - Get the list of most active users in GitHub by country</title>
<title>List of most active users in GitHub - GitHubStats</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
69 changes: 49 additions & 20 deletions client/src/App.js
Expand Up @@ -33,36 +33,65 @@ function App() {

<div className="nav-scroller bg-white col-10 p-3 m-auto table-responsive">
<h5>How it works?</h5>
<h6 className="large">
This is a list of most active GitHub users in the country over the past year based on public and private contributions of each user.
<h6 className="pl-2 pr-2 pt-2 pb-1">
List of most active GitHub users in the country over the past year based on public contributions of each user.
</h6>
<h6 className="large bg-light p-2">
The contributors can get their link to the profile as shown below. Create your pull request and add changes to the project <a href={"https://github.com/gayanvoice/githubstats-github-graphql"}>gayanvoice/githubstats-github-graphql</a>.
<h6 className="bg-light pl-2 pr-2 pt-1 pb-2">
To contribute, create your pull request and add changes to the project <a href={"https://github.com/gayanvoice/githubstats-github-graphql"}>gayanvoice/githubstats-github-graphql</a>.
</h6>
</div>

<div className="nav-scroller bg-white col-10 p-3 m-auto">
<h5>Technologies used</h5>
<img alt={"gayanvoice"}
src={"https://raw.githubusercontent.com/gayanvoice/githubstats-github-graphql/images/github-stats-3.PNG"}
className={"img-fluid"}/>
<h5>Frameworks</h5>
<nav className="nav mb-1">
<a className="m-1" href={"https://github.com/Node.js"}>
<img alt={"Node.js"} src={"https://avatars1.githubusercontent.com/u/9950313?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/expressjs"}>
<img alt={"expressjs"} src={"https://avatars1.githubusercontent.com/u/5658226?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/mongodb"}>
<img alt={"mongodb"} src={"https://avatars1.githubusercontent.com/u/45120?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/facebook/react"}>
<img alt={"facebook"} src={"https://avatars1.githubusercontent.com/u/69631?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/graphql"}>
<img alt={"graphql"} src={"https://avatars1.githubusercontent.com/u/12972006?s=48&v=4"} className={"rounded"}/>
</a>
</nav>
</div>

<div className="nav-scroller bg-white col-10 p-3 m-auto">
<h5>Deploy</h5>
<nav className="nav mb-1">
<a className="m-1" href={"https://heroku.com/"}>
<img alt={"Node.js"} src={"https://avatars1.githubusercontent.com/u/23211?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://www.mongodb.com/cloud/atlas"}>
<img alt={"expressjs"} src={"https://avatars1.githubusercontent.com/u/45120?s=48&v=4"} className={"rounded"}/>
</a>
</nav>
</div>

<div className="nav-scroller bg-white col-10 p-3 m-auto table-responsive">
<h5>Contributors</h5>
<nav className="nav mb-1">
<a className="m-1" href={"https://github.com/gayanvoice"}><img alt={"gayanvoice"}
src={"https://avatars1.githubusercontent.com/u/30500175?s=48&v=4"}
className={"rounded"}/></a>
<a className="m-1" href={"https://github.com/srdjanRakic"}><img alt={"srdjanRakic"}
src={"https://avatars1.githubusercontent.com/u/16154503?s=48&v=4"}
className={"rounded"}/></a>
<a className="m-1" href={"https://github.com/nikolalukovic"}><img alt={"nikolalukovic"}
src={"https://avatars0.githubusercontent.com/u/6897673?s=48&v=4"}
className={"rounded"}/></a>
<a className="m-1" href={"https://github.com/Donghoon759"}><img alt={"Donghoon759"}
src={"https://avatars0.githubusercontent.com/u/32301380?s=48&v=4"}
className={"rounded"}/></a>
<a className="m-1" href={"https://github.com/gayanvoice"}>
<img alt={"gayanvoice"} src={"https://avatars1.githubusercontent.com/u/30500175?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/srdjanRakic"}>
<img alt={"srdjanRakic"} src={"https://avatars1.githubusercontent.com/u/16154503?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/nikolalukovic"}>
<img alt={"nikolalukovic"} src={"https://avatars0.githubusercontent.com/u/6897673?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/Donghoon759"}>
<img alt={"Donghoon759"} src={"https://avatars0.githubusercontent.com/u/32301380?s=48&v=4"} className={"rounded"}/>
</a>
<a className="m-1" href={"https://github.com/AWIXOR"}>
<img alt={"AWIXOR"} src={"https://avatars0.githubusercontent.com/u/43700517?s=48&v=4"} className={"rounded"}/>
</a>

</nav>
<h6><span className="small">How to contribute? <a
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Country.js
Expand Up @@ -15,10 +15,10 @@ class Country extends Component {
}

compare( a, b ) {
if ( a.public_contributions + a.private_contributions < b.public_contributions + b.private_contributions ){
if ( a.public_contributions < b.public_contributions ){
return 1;
}
if ( a.public_contributions + a.private_contributions > b.public_contributions + b.private_contributions ){
if ( a.public_contributions > b.public_contributions ){
return -1;
}
return 0;
Expand Down Expand Up @@ -125,7 +125,7 @@ class Country extends Component {
</a>
</td>
<td className="text-black-50 align-middle text-break">{item.location}</td>
<td className="font-weight-bold align-middle">{item.public_contributions + item.private_contributions}</td>
<td className="font-weight-bold align-middle">{item.public_contributions}</td>
</tr>
})}
</tbody>
Expand Down
52 changes: 29 additions & 23 deletions server.js
Expand Up @@ -25,15 +25,15 @@ var country = [
{city: ["Estonia", "Eesti", "Tallinn", "Tartu", "Narva"]},
{city: ["Finland", "Suomi", "Helsinki", "Tampere", "Oulu", "Espoo", "Vantaa", "Turku"]},
{city: ["France", "Paris", "Marseille", "Lyon", "Toulouse", "Nice", "Lille"]},
{city: ["Germany", "Deutschland", "Berlin", "Frankfurt", "Munich", "München", "Hamburg", "Cologne"]},
{city: ["Germany", "Berlin", "Frankfurt", "Munich", "Hamburg", "Cologne"]},
{city: ["Greece", "Athens", "Thessaloniki", "Patras", "Heraklion", "Larissa", "Crete"]},
{city: ["Hong_Kong", "HongKong"]},
{city: ["India", "Bangalore", "Mumbai", "Delhi", "Kolkata", "Chennai"]},
{city: ["Indonesia", "Jakarta", "Surabaya", "Bandung", "Medan"]},
{city: ["Ireland", "Dublin", "Galway", "Cork", "Limerick", "Belfast", "Waterford", "Londonderry", "Drogheda"]},
{city: ["Israel", "TelAviv", "Jerusalem", "Beersheva", "Netanya", "Haifa", "Herzliya", "Rishon"]},
{city: ["Italy", "Italia", "Rome", "Milan", "Naples", "Napoli", "Turin", "Torino", "Palermo", "Genoa", "Genova", "Bologna", "Florence", "Firenze", "Bari", "Catania", "Venice", "Verona"]},
{city: ["Japan", "Tokyo", "Yokohama", "Osaka", "Nagoya", "Sapporo", "Kobe", "Kyoto", "Fukuoka", "Kawasaki", "Saitama", "Hiroshima", "Sendai"]},
{city: ["Japan", "Tokyo", "Yokohama", "Osaka", "Nagoya", "Kyoto", "Hiroshima"]},
{city: ["Latvia", "Latvija", "Riga", "Kuldiga", "Ventspils", "Liepaja"]},
{city: ["Luxembourg", "Eifferdange", "Dudelange", "Ettelbruck"]},
{city: ["Macedonia", "Skopje", "Veles", "Ohrid", "Bitola", "Kumanovo", "Strumica", "Tetovo", "Gostivar", "Struga", "Kichevo", "Kavadarci", "Berovo"]},
Expand All @@ -47,7 +47,7 @@ var country = [
{city: ["Pakistan", "Karachi", "Lahore", "Faisalabad", "Rawalpindi", "Islamabad"]},
{city: ["Philippines", "Quezon", "Manila", "Davao", "Caloocan", "Cebu"]},
{city: ["Poland", "warsaw", "Kraków", "Wrocław", "Gdańsk", "Poznań", "Katowice", "Łódź", "Lublin"]},
{city: ["Portugal", "Lisbon", "Lisboa", "Braga", "Porto", "Madeira"]},
{city: ["Portugal", "Lisbon", "Lisboa", "Braga", "Madeira"]},
{city: ["Romania", "Bucharest", "Cluj", "Iasi", "Timisoara", "Craiova"]},
{city: ["Russia", "Moscow", "SaintPetersburg", "Novosibirsk", "Yekaterinburg", "Omsk", "Kazan", "Volgograd"]},
{city: ["Serbia", "Srbija", "Србија", "Beograd", "NoviSad", "Nis", "Niš", "Kragujevac", "Užice", "Čačak", "Београд", "НовиСад", "Ниш", "Крагујевац", "Ужице", "Чачак"]},
Expand All @@ -64,7 +64,7 @@ var country = [
{city: ["United_States", "UnitedStates", "PaloAlto", "NewYork", "California", "SanFrancisco"]},
{city: ["Vietnam", "HoChiMinh", "Hanoi", "Saigon", "DaNang", "NhaTrang", "HaiPhong"]},
];

var start = true;
const app = express();

// app keep alive
Expand All @@ -74,31 +74,37 @@ setInterval(function() {
}, 300000);

app.get('/admin/start', (req, res) => {
console.log(country.length/2);
try {
(async () => {
var delay = 5000, increment = 0, key = keys[0];
// Rate limit https://developer.github.com/v4/guides/resource-limitations/
if(start){
start = false;
(async () => {
var delay = 5000, increment = 0, key = keys[0];
// Rate limit https://developer.github.com/v4/guides/resource-limitations/

const fx = ({city}) =>
new Promise(resolve => setTimeout(resolve, delay, city)).then(data =>
new GraphQuery(data, key, records, url).request());
const fx = ({city}) =>
new Promise(resolve => setTimeout(resolve, delay, city)).then(data =>
new GraphQuery(data, key, records, url).request());

for (let {city} of country) {
await fx({city});
if(increment<(country.length/2)){
key = keys[0];
for (let {city} of country) {
await fx({city});
if(increment<(country.length/2)){
key = keys[0];

} else {
key = keys[1];
} else {
key = keys[1];
}
increment = increment + 1;
delay = 600000;
}
increment = increment + 1;
delay = 600000;
}
start = true;
})();
res.send('server.js Process is already working');
} else {
res.send('server.js Process is not working');
}

})();
res.send('server.js STARTED REFRESH');
console.log("server.js STARTED REFRESH");
//res.send('server.js STARTED REFRESH');
//console.log("server.js STARTED REFRESH");
} catch (e) {
res.send("server.js ERROR IN ASYNC");
}
Expand Down

0 comments on commit 0587a3e

Please sign in to comment.