Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Add Shields.io badges to readme#11

Merged
abhijeet-reddy merged 8 commits intoabhijeet-reddy:masterfrom
k3KAW8Pnf7mkmdSMPHz27:patch-1
Jan 11, 2021
Merged

Add Shields.io badges to readme#11
abhijeet-reddy merged 8 commits intoabhijeet-reddy:masterfrom
k3KAW8Pnf7mkmdSMPHz27:patch-1

Conversation

Copy link
Contributor

k3KAW8Pnf7mkmdSMPHz27 commented Jan 8, 2021 *
edited
Loading

Hello, first of all, nice repository and thank you for your effort in creating it!

I just thought I'd add this as a suggested use of the API.
For an "in-action" example, I added a CodeChef badge with my global ranking on my own GitHub profile https://github.com/k3KAW8Pnf7mkmdSMPHz27/ (under hobbies, sometimes it can take 5 s to load, probably if the cache is invalidated).
It mostly work if the cache lifetime value is high enough, occasionally it shows an error message instead of my rank

Some thing to note that you might want to change, or I can address them later,

  1. The example images shown are not dynamic, but they can be made dynamic with a long HTTP cache lifetime. I can volunteer my account on the sites that I have, otherwise one can just pick anyone from top10 or a personal favourite competitive programmer (I'd go with Errichto based on his youtubes)
  2. The example code should probably have a HTTP cache lifetime value as well. The one I have is updated once a day, which is much more frequent than I need for my occasional monthly long codechef challenge Feel free to suggest what you consider to be a reasonable refresh time and I'll add it to the "code" examples.
  3. The badges/shields that I have not included does not have an icon on https://simpleicons.org/ . This is not a problem per say, as it is possible to use an image. I have not had time to do so. I can submit one/more PR whenever I have time to add more badges.
  4. Leetcode is listed on simpleicons but when I were writing the changes I kept getting "internal server error" and I am not sure why. I did not have time to look into it. I can probably submit a PR for that as well at some point in the future. Unfortunately, time is a limited resource

Copy link
Owner

abhijeet-reddy commented Jan 9, 2021

Hello, first of all, nice repository and thank you for your effort in creating it!

I just thought I'd add this as a suggested use of the API.
For an "in-action" example, I added a CodeChef badge with my global ranking on my own GitHub profile https://github.com/k3KAW8Pnf7mkmdSMPHz27/ (under hobbies, sometimes it can take 5 s to load, probably if the cache is invalidated).
It mostly work if the cache lifetime value is high enough, occasionally it shows an error message instead of my rank

Some thing to note that you might want to change, or I can address them later,

  1. The example images shown are not dynamic, but they can be made dynamic with a long HTTP cache lifetime. I can volunteer my account on the sites that I have, otherwise one can just pick anyone from top10 or a personal favourite competitive programmer (I'd go with Errichto based on his youtubes)
  2. The example code should probably have a HTTP cache lifetime value as well. The one I have is updated once a day, which is much more frequent than I need for my occasional monthly long codechef challenge Feel free to suggest what you consider to be a reasonable refresh time and I'll add it to the "code" examples.
  3. The badges/shields that I have not included does not have an icon on https://simpleicons.org/ . This is not a problem per say, as it is possible to use an image. I have not had time to do so. I can submit one/more PR whenever I have time to add more badges.
  4. Leetcode is listed on simpleicons but when I were writing the changes I kept getting "internal server error" and I am not sure why. I did not have time to look into it. I can probably submit a PR for that as well at some point in the future. Unfortunately, time is a limited resource

Hi, thanks for the appreciation and suggestion.
Regarding the 1st change, you can go with your account or mine.
For the second, we can update Codechef and Codeforces once a day as the scores might not change too often and for all others we can go with 1 hour.
For the third, I'll see if I can help.

Copy link
Owner

abhijeet-reddy commented Jan 9, 2021

Hello, first of all, nice repository and thank you for your effort in creating it!

I just thought I'd add this as a suggested use of the API.
For an "in-action" example, I added a CodeChef badge with my global ranking on my own GitHub profile https://github.com/k3KAW8Pnf7mkmdSMPHz27/ (under hobbies, sometimes it can take 5 s to load, probably if the cache is invalidated).
It mostly work if the cache lifetime value is high enough, occasionally it shows an error message instead of my rank

Some thing to note that you might want to change, or I can address them later,

  1. The example images shown are not dynamic, but they can be made dynamic with a long HTTP cache lifetime. I can volunteer my account on the sites that I have, otherwise one can just pick anyone from top10 or a personal favourite competitive programmer (I'd go with Errichto based on his youtubes)
  2. The example code should probably have a HTTP cache lifetime value as well. The one I have is updated once a day, which is much more frequent than I need for my occasional monthly long codechef challenge Feel free to suggest what you consider to be a reasonable refresh time and I'll add it to the "code" examples.
  3. The badges/shields that I have not included does not have an icon on https://simpleicons.org/ . This is not a problem per say, as it is possible to use an image. I have not had time to do so. I can submit one/more PR whenever I have time to add more badges.
  4. Leetcode is listed on simpleicons but when I were writing the changes I kept getting "internal server error" and I am not sure why. I did not have time to look into it. I can probably submit a PR for that as well at some point in the future. Unfortunately, time is a limited resource

Can you give more details on the Leetcode error? It's working fine with my username.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 10, 2021 *
edited
Loading

Can you give more details on the Leetcode error? It's working fine with my username.

This is strange. It does work with my username (https://competitive-coding-api.herokuapp.com/api/leetcode/xQZyhWSJ)
But both uwi https://competitive-coding-api.herokuapp.com/api/leetcode/uwi and superluminal (https://competitive-coding-api.herokuapp.com/api/leetcode/superluminal)
gives me
{"message": "Internal Server Error"}

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 10, 2021

Regarding the 1st change, you can go with your account or mine.

I compromised, I used my CodeChef and your Codeforces

For the second, we can update Codechef and Codeforces once a day as the scores might not change too often and for all others we can go with 1 hour.

Done.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 10, 2021

For the dynamic badges I also linked them to the platform's profile page, perhaps I should remove the link?

Copy link
Owner

abhijeet-reddy commented Jan 11, 2021

Can you give more details on the Leetcode error? It's working fine with my username.

This is strange. It does work with my username (https://competitive-coding-api.herokuapp.com/api/leetcode/xQZyhWSJ)
But both uwi https://competitive-coding-api.herokuapp.com/api/leetcode/uwi and superluminal (https://competitive-coding-api.herokuapp.com/api/leetcode/superluminal)
gives me
{"message": "Internal Server Error"}

Maybe we are missing some case. We'll find the problem and fix it. I opened an issue #12 for it.

k3KAW8Pnf7mkmdSMPHz27 reacted with thumbs up emoji k3KAW8Pnf7mkmdSMPHz27 reacted with eyes emoji

Copy link
Owner

abhijeet-reddy commented Jan 11, 2021

Regarding the 1st change, you can go with your account or mine.

I compromised, I used my CodeChef and your Codeforces

For the second, we can update Codechef and Codeforces once a day as the scores might not change too often and for all others we can go with 1 hour.

Done.

Not a problem . We can go with any contributor if they agree .

k3KAW8Pnf7mkmdSMPHz27 reacted with laugh emoji

Copy link
Owner

abhijeet-reddy commented Jan 11, 2021

For the dynamic badges I also linked them to the platform's profile page, perhaps I should remove the link?

I don't see any problem linking it to profile, maybe we should keep it .

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 11, 2021

For the dynamic badges I also linked them to the platform's profile page, perhaps I should remove the link?

I don't see any problem linking it to profile, maybe we should keep it .

Nvm. I confused myself with the alt="..." vs title="..." tags. If you don't want to be confused, ignore what I said

abhijeet-reddy reacted with laugh emoji

abhijeet-reddy merged commit 213dbfe into abhijeet-reddy:master Jan 11, 2021
Copy link
Contributor

saurabh-prakash commented Jan 11, 2021

For an "in-action" example, I added a CodeChef badge with my global ranking on my own GitHub profile https://github.com/k3KAW8Pnf7mkmdSMPHz27/ (under hobbies, sometimes it can take 5 s to load, probably if the cache is invalidated).

@k3KAW8Pnf7mkmdSMPHz27 this (~5s latency) is probably because @Abhijeet-AR has deployed this app on heroku free account and it kills the app due to longer periods of inactivity (AFAIK about heroku). Therefore, upon a new request after such a duration of inactivity, heroku respawns the app and that is where the latency is. @Abhijeet-AR can confirm this by observing the activity graphs in his heroku account.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 11, 2021

Aha. In that case I don't see it becoming an issue. Perhaps I were just unlucky with the Shields caching (1 hour) and Heroku killing it off

abhijeet-reddy and saurabh-prakash reacted with laugh emoji

Copy link
Owner

abhijeet-reddy commented Jan 12, 2021

For an "in-action" example, I added a CodeChef badge with my global ranking on my own GitHub profile https://github.com/k3KAW8Pnf7mkmdSMPHz27/ (under hobbies, sometimes it can take 5 s to load, probably if the cache is invalidated).

@k3KAW8Pnf7mkmdSMPHz27 this (~5s latency) is probably because @Abhijeet-AR has deployed this app on heroku free account and it kills the app due to longer periods of inactivity (AFAIK about heroku). Therefore, upon a new request after such a duration of inactivity, heroku respawns the app and that is where the latency is. @Abhijeet-AR can confirm this by observing the activity graphs in his heroku account.

Yes, in Heroku's free version server goes to sleep after 30 minutes of inactivity. I was thinking it was due to Shield, I didn't think about Heroku .

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 12, 2021 *
edited
Loading

Hum... I'll look into it more... It might be that Shields uses a time-out... or it is completely unrelated.

Copy link
Owner

abhijeet-reddy commented Jan 13, 2021

Hum... I'll look into it more... It might be that Shields uses a time-out... or it is completely unrelated.

It's showing unresponsive on your page, but it seems to work fine on our current repository.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 13, 2021

That is strange. My (so far subjective, I have not looked into the details) impression is that I get the broken image every time Shields cache gets invalidated.
I have never seen the "unresponsive" message. It is for sure better than just a broken link. Are you using Chrome?

Copy link
Owner

abhijeet-reddy commented Jan 13, 2021

That is strange. My (so far subjective, I have not looked into the details) impression is that I get the broken image every time Shields cache gets invalidated.
I have never seen the "unresponsive" message. It is for sure better than just a broken link. Are you using Chrome?

Nope. I'm using safari. But I checked on chrome too, it's showing the same. If you changed it recently, once check if you made any mistake in URL.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 13, 2021 *
edited
Loading

Nope. I'm using safari. But I checked on chrome too, it's showing the same. If you changed it recently, once check if you made any mistake in URL.

I have not, but I am using a different URL than this repository so perhaps. I'll see if I can look into it when I add more badges, it would be a shame if it doesn't work as intended.

abhijeet-reddy reacted with thumbs up emoji

Copy link
Contributor

saurabh-prakash commented Jan 17, 2021

The "UNRESPONSIVE" is due to github caching, I think

See the img src. It is from camo.githubusercontent. "data-cannonical-src" is the actual source and despite it being working in later API calls, github may have cached the first response from shields API (when our API gave an error).

Ideally, we need the img src to have the value that is contained in "data-cannonical-src". But, github modifies that url. Read this.

We'll probably need to purge Camo cache when this occurs.

Copy link
Contributor

saurabh-prakash commented Jan 17, 2021

There are 2 hard problems in Computer Science:

  1. Variable Naming
  2. Cache Invalidation
  3. One-off errors

We've hit cache-invalidation in this case.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 17, 2021 *
edited
Loading

Yup. Sorry about that. The cache(s) made me believe this would work better out of the box. @Abhijeet-AR feel free to remove this use-case again.

In addition to the potential cache issues, there is an issue when loading an image takes longer than 4 s. Given the Heroku startup time that can be problematic.

Copy link
Contributor Author

k3KAW8Pnf7mkmdSMPHz27 commented Jan 17, 2021

I'll be quite busy for two weeks or so. I can revisit this issue afterward and see if I can come up with a workaround.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer

abhijeet-reddy abhijeet-reddy left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants