From d9dca6e8f6709a3e25e98aacd70329bfef0f91f5 Mon Sep 17 00:00:00 2001 From: 7rans Date: Tue, 19 Nov 2013 17:31:01 -0500 Subject: [PATCH] Opt-in by starring resume.github.com project. --- README.markdown | 14 +++++--------- index.html | 1 - js/githubresume.js | 26 +++++++++++++++++++++++++- js/opt_out_users.js | 35 ----------------------------------- 4 files changed, 30 insertions(+), 46 deletions(-) delete mode 100644 js/opt_out_users.js diff --git a/README.markdown b/README.markdown index ce47c88..b32304b 100644 --- a/README.markdown +++ b/README.markdown @@ -1,16 +1,12 @@ -####A service that creates your resume based on your GitHub repos. +#### A service that creates your resume based on your GitHub repos. Possible Usecases: * Boon for all the tech-savy bosses who want to have a **quick view** of person's git/github activity, _before the interview_ -### Opt-Out +### Opt-In -Thanks to @augustl, folks are now able to opt-out. I agree the process is still a tad laborious but basically here's how you opt-out. +GitHub Resume is now opt-in rather than opt-out! To make your resume visible +just **star** this project, [resume/resume.github.com](https://github.com/resume/resume.github.com). +That's all there is to it! -1. Fork this repo -2. In your forked repository, add your username to the file `js/opt_out_users.js`, save, and push to your repository. -3. Issue a pull request to resume/resume.github.com -4. I'll merge. - -The other way, which can take longer due to the fact that I (@davidcoallier) am bound by the current contraints of our time-space continuum is to ask politely (with a please and thanks (thanks is optional)) on Twitter. diff --git a/index.html b/index.html index 3ad2874..0265553 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,6 @@ - diff --git a/js/githubresume.js b/js/githubresume.js index 30ae6a0..212f456 100644 --- a/js/githubresume.js +++ b/js/githubresume.js @@ -79,12 +79,36 @@ var github_user_orgs = function(username, callback) { $.getJSON('https://api.github.com/users/' + username + '/orgs?callback=?', callback); } +var github_user_stars = function(username) { + var repos = []; + $.ajax({ + url: 'https://api.github.com/users/' + username + '/starred', + async: false, + dataType: 'json', + success: function(json) { + repos = json; + } + }); + return repos; +} + +var github_user_starred_resume = function(username) { + var starred = false; + var repos = github_user_stars(username); + $.each(repos, function(i, repo) { + if (repo.full_name == "resume/resume.github.com") { + starred = true; + } + }); + return starred; +} + var run = function() { var itemCount = 0, maxItems = 5, maxLanguages = 9; - if (githubresume_opt_out_users.indexOf(username) >= 0) { + if (! github_user_starred_resume(username)) { $.ajax({ url: 'views/opt_out.html', dataType: 'html', diff --git a/js/opt_out_users.js b/js/opt_out_users.js deleted file mode 100644 index 1221c32..0000000 --- a/js/opt_out_users.js +++ /dev/null @@ -1,35 +0,0 @@ -var githubresume_opt_out_users = [ - "augustl", - "kmcallister", - "ntlk", - "raganwald", - "iamdanw", - "iamdanw_ms", - "igalic", - "mattfield", //"https://twitter.com/mattfieldy/status/402432266208821248" - "evilchili", - "jsfernandes", - "davw", - "listrophy", - "jcoglan", - "nrb", - "drtortoise", - "gregkare", - "eee-c", - "jacobian", - "davidstanley01", - "brianhicks", - "jacknagel", - "pnasrat", - "wraithan", - "dominic", - "alex", - "nikhilsrinivasan", - "jnoller", - "remarkablerocket", - "bitprophet", - "brianvh", - // Bigger batch until #117 - "catsby", "kennethlove", "danimal", "dreid", "lacion", "jezdez", "smoynes", "justinabrahms", - "fcurella", "binarydud", "dmpayton", "retro", "acdha", "pydanny", "nibrahim", "juliepagano" -];