{"id":17303035,"url":"https://github.com/binarybrain/bestfan","last_synced_at":"2025-03-26T22:44:25.632Z","repository":{"id":145547167,"uuid":"50016259","full_name":"BinaryBrain/BestFan","owner":"BinaryBrain","description":"Web service showing you who is your best fan on GitHub","archived":false,"fork":false,"pushed_at":"2016-01-22T22:58:16.000Z","size":4722,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"gh-pages","last_synced_at":"2025-02-01T04:29:48.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BinaryBrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T08:34:26.000Z","updated_at":"2016-01-23T15:21:45.000Z","dependencies_parsed_at":"2023-04-19T00:37:36.613Z","dependency_job_id":null,"html_url":"https://github.com/BinaryBrain/BestFan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBrain%2FBestFan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBrain%2FBestFan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBrain%2FBestFan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBrain%2FBestFan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinaryBrain","download_url":"https://codeload.github.com/BinaryBrain/BestFan/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245749853,"owners_count":20666084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T11:49:21.223Z","updated_at":"2025-03-26T22:44:25.602Z","avatar_url":"https://github.com/BinaryBrain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Best Fan\n\nBest Fan is a web service showing you who is your best fan on GitHub, according to who gave you stars.\n\n[Try it know!](http://binarybrain.github.io/BestFan/)\n\n## Introduction\n\nThis work has been done as a homework for the HEIG-VD.\n\nThe purpose of this project is to learn how to use the GitHub API and create a cool data viz app with it.\n\n## Github API\n\nI'm using the GitHub API to access users' repositories, and than, to know who has starred a given user's repo.\n\nTo acess a given user list of repos, we can just call: `https://api.github.com/users/:username/repos`.\n\nIt give us a huge array of object representing repos. Each repo contains:\n\n```js\n{\n\t\"stargazers_url\": \"https://api.github.com/repos/BinaryBrain/ant/stargazers\",\n\t\"stargazers_count\": 4,\n\t// More stuff\n}\n```\n\nIf we than call the given URL (`stargazers_url`), we obtain a list of user in this form:\n\n```js\n{\n\t\"login\": \"BinaryBrain\",\n\t\"id\": 1102077,\n\t\"avatar_url\": \"https://avatars.githubusercontent.com/u/1102077?v=3\",\n\t\"url\": \"https://api.github.com/users/BinaryBrain\",\n\t\"html_url\": \"https://github.com/BinaryBrain\",\n\t// More stuff\n}\n```\n\n## Handling data\n\nOnce we obtained the list of repos for the given users, we can seek for stargazers for each repositories.\nThat mean we will call the `stargazers_url` as many time as we have repos, obviously in parallel, and put every stargazers in a big array.\n\nWe will then just count how many time we have a user in our array and that will gives us how a user like our work.\n\nWe then just have to sort every thing to make a nice ranking.\n\n## AngularJS\n\nI tried to use AngularJS as much as I could (without overdoing it) because it was also a part of the homework.\n\nI just have one controller with an input that passes its content from the view to the model using the `ng-model=\"username\"` attribute.\n\nTo display data, I use the `ng-repeat=\"fan in fans\"` attribute to loop over every stargazers and display their data.\n\nTo generate the graph at the top of the window, I use the `ng-style` attribute so I can use data from the scope to generate the graph as I want.\n\n## Graph\n\nThe graph being pretty simple, I generated it manually (without using any overkill lib). It just shows the user the proportion of stars he has from each stargazers.\n\n## Random Colors\n\nTo generate graph's colors, I use the awesome lib [RandomColor by David Merfield](https://github.com/davidmerfield/randomColor).\n\nIt allows me to generate random colors that are beautiful and light. Otherwise, if we just use a RGB color with three random values, we would end up having a lot of brownish colors.\n\n## Conclusion\n\nI'm happy to see that works pretty well and it's always fun to see who like what you are doing.  \nI did discover that a user I didn't know has starred one of my repo and I went to his GitHub profile to see what he does. Turns out he's a pretty interesting coder!\n\nThis project may enhance the social aspect of GitHub, which I particularly like.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarybrain%2Fbestfan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarybrain%2Fbestfan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarybrain%2Fbestfan/lists"}