Comments (10)
i'll take a look at the github api
from dogecoin.com.
@edswf1 there should be a JS wrapper for their api that supports this right out the box...here
Unless @patricklodder prefers an in house solution to decrease the amount of libs we are loading
from dogecoin.com.
@edswf1 there should be a JS wrapper for their api that supports this right out the box...here
Unless @patricklodder prefers an in house solution to decrease the amount of libs we are loading
i don't think a library is needed, this simple function should do it:
function getFromGHAPI(source){
let baseUrl = 'https://api.github.com/repos/dogecoin/dogecoin/';
$.get(baseUrl + source + '?per_page=1').done(function(ret, responseText, jqXHR){
try{
var linkText = jqXHR.getResponseHeader('link');
var last = linkText.split(',')[1];
var count = last.split('&page=')[1].replace(/[^0-9]+/, '');
console.log(count);
}
catch(e){
console.error(e);
}
});
}
getFromGHAPI('commits'); //get number of commits -> 13532
getFromGHAPI('forks'); //get number of forks -> 1157
getFromGHAPI('releases'); //get number of releases -> 36
getFromGHAPI('contributors'); //get number of forks -> 349
in Detail:
when per_page parameter is set, GH API returns a 'link' response header with next and last page. As we request only one item per page, the number of the last page is also the number of total elements available by GH API.
This is apparently not what GH uses to display numbers in the repository as there are 201 Contributors and 159 Releases there.
Edit: Seems like only published releases are available through GH API. No idea about contributors count though. But hey, numbers are close to the truth ;)
Edit 2: as GH API Limits Calls to 60/h/IP, a fallback and caching of those numbers would be needed
from dogecoin.com.
@edswf1 wow this is real elegant. Great job!
as GH API Limits Calls to 60/h/IP, a fallback and caching of those numbers would be needed
Local Storage my guy
from dogecoin.com.
Local Storage my guy
true. i was just trying to say that the function is by no means complete yet
from dogecoin.com.
Hmm actually I'm not sure that would work because traffic to the site definitely has potential for more than 60 users per hour. Maybe create some routine to write those metrics your functions pull into a readable assets file? Then read those values and display.
Then, I think we can use local storage to prevent reading from file on every page load.
We could actually take this a step further and create a github action to write those stats to file based on some trigger...but that's probably too brute force for right now. I'd like to hear input from others first.
from dogecoin.com.
Hmm actually I'm not sure that would work because traffic to the site definitely has potential for more than 60 users per hour.
As i understood, this limit is per client IP. I think putting current values as a fallback would cover most errors then
from dogecoin.com.
As i understood, this limit is per client IP
Oh ok per client ip..yeah that should be fine
from dogecoin.com.
Am I wrong in assuming that due to the way Dogecoin Core is being developed such a graphic would not reflect the real amount of work being done on Doge? Patrick or Sporklin mentioned on r/dogecoindev (cannot find the thread now, thanks to reddit's beautiful search) that the github repo shows little activity because they develop the major releases in a repository not linked directly to github.
Correct me if I am wrong!
from dogecoin.com.
@magneticat I'm not actually sure about that! But where ever the repo lays, I'm sure we can pull stats from it. @patricklodder savvy?
from dogecoin.com.
Related Issues (20)
- Add a link to the Accepting Doge merchants directory: shopdoge.xyz
- Enhancement: top meme posts feed from r/dogecoin HOT 1
- add instructions on how to mine dogecoins on the website HOT 2
- Website redesign HOT 1
- Support page language drop-down menu not displaying properly HOT 3
- List exchanges dogecoin can be purchased on website HOT 1
- Add GitHub Repo link of website on footer with other social icons
- Add 2 new tab for recording and displaying Dogecoin merchant.
- Such Redesign. Very Enhance.
- Dutch Language added
- Is it still worth contributing? HOT 1
- Norwegian Translation
- site is a 404. lol. HOT 1
- Increase per-screen limit of wallets displayed from 10 to 12 or 14. HOT 1
- Needs a license file.
- Please revert title of "XDP Wallet" to "DogeWallet" HOT 1
- Add links to TipmySite and AcceptDoge on Dogecoin dot com
- Refactor: Dogecoin.com for Vuejs and Tailwind
- Refactor: Modern NextJS website for Dogecoin Website
- Feature: Archive Repo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dogecoin.com.