Giter VIP home page Giter VIP logo

gh-stats's Introduction

gh-stats

gh-stats is a simple solution to the GitHubIntegration coding exercise completeted for the Bitsight interview process.

This webapp provides two buttons and corresponding tables to display information from the publicly accessible portion of GitHub API (v3). The first table displays "Hot Repositories"; the 5 repositories with the most stars, created last month. The second table displays "Prolific Users"; the 5 users with the most followers, created in the last year.

Both tables can be updated by clicking the corresponding button, and both will update every two minutes on their own.

Usage

Open index.html in Google Chrome.

Tech

This app was written mostly with vanilla Javascript, ECMAScript 2015 was used, so a modern browser is required.

gh-stats runs with only one external library: moment.js. I decided to include this small library to handle date ranges for filtering, as the native Date object produces a lot of gotchas eg. adding 1 month to Jan 30th produces March 2nd, etc.

The app has four other files:
app.js- Binds update events, initiates requests for new data, and updates the GUI.
GitHubQuery.js- Provides the GitHubQuery class which can search and query the GitHub API
index.html- Base layout
app.css- style, CSS3 flexbox

Other Considerations

Due to the time constraint, there are some things I would change and add to this app.

Development done in Google Chrome 64, though I expect any modern browser will work due to the simplicity of the application.

I would monitor request rates to prevent spamming the GitHub API. GitHub provides information about requests made and the time in which the request window resets in every HTTP response header.

The functions used to update the tables, updateUserTable and updateRepoTable are good candidates for refactoring; could probably be combined.

Error handling is minimal to say the least - I included a function to catch promise rejections, though it only logs errors to the console. Depending on the error, it would be nice to provide the user with some feedback, eg. "Unable to connect", "Too many requests", etc.

No tests, and I do not always validate function input. getUsers(), search(), and request() are candidates for unit tests.

These files could be concatenated & minified, though for this exercise I did not think it necessary.

Author

Andrew Gomez
[email protected]

gh-stats's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.