{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/3995","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/3995/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/3995/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/3995/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/pull/3995","id":114093599,"number":3995,"title":"Save bonfire's solution as a GitHub gist","user":{"login":"bugron","id":13225220,"avatar_url":"https://avatars.githubusercontent.com/u/13225220?v=3","gravatar_id":"","url":"https://api.github.com/users/bugron","html_url":"https://github.com/bugron","followers_url":"https://api.github.com/users/bugron/followers","following_url":"https://api.github.com/users/bugron/following{/other_user}","gists_url":"https://api.github.com/users/bugron/gists{/gist_id}","starred_url":"https://api.github.com/users/bugron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bugron/subscriptions","organizations_url":"https://api.github.com/users/bugron/orgs","repos_url":"https://api.github.com/users/bugron/repos","events_url":"https://api.github.com/users/bugron/events{/privacy}","received_events_url":"https://api.github.com/users/bugron/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/QA","name":"QA","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-10-29T16:42:52Z","updated_at":"2015-11-06T23:49:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/pulls/3995","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/pull/3995","diff_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/pull/3995.diff","patch_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/pull/3995.patch"},"body":"Adds the feature requested in https://github.com/FreeCodeCamp/FreeCodeCamp/issues/1343. Looks like this: http://prntscr.com/8vvgd7, two examples of gists: https://gist.github.com/anonymous/29ee0f9a9e21d34e78eb, https://gist.github.com/anonymous/8a9f708ac77a7c002011.\r\nA couple of words about the implementation. By clicking that \"create gists\" button a new blank window is opened. After that we perform an AJAX `post` request to `api.github.com/gists` with the appropriate data (`data` object). From `api.github`'s response we get the `html_url` of the newly created **anonymous** gist. Then we change the window's `location.href`.\r\nYou should notice two things:\r\n1. These gists are anonymous because we need to get user's authentication info to make them authorized (and I've no idea how to do that). As @BerkeleyTrue said \"I don’t think there is going to be a way that we can share that information with the client side\" (if user's GitHub account is linked to user's FCC account).\r\n2. The new window is going to be blank until we get the answer from `api.github.com/gists`.\r\nThis is done because the browser will normally block the window like any other pop-up. To avoid this we need to open the window immediately after the button click and do any manipulations (in this case changing `location.href`) after AJAX request.\r\nAnother way is performing a synchronous AJAX request but this will freeze the browser until GitHub's response.\r\nCloses #1343."},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/comments/154579634","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/pull/3995#issuecomment-154579634","issue_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/3995","id":154579634,"user":{"login":"ltegman","id":1381313,"avatar_url":"https://avatars.githubusercontent.com/u/1381313?v=3","gravatar_id":"","url":"https://api.github.com/users/ltegman","html_url":"https://github.com/ltegman","followers_url":"https://api.github.com/users/ltegman/followers","following_url":"https://api.github.com/users/ltegman/following{/other_user}","gists_url":"https://api.github.com/users/ltegman/gists{/gist_id}","starred_url":"https://api.github.com/users/ltegman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltegman/subscriptions","organizations_url":"https://api.github.com/users/ltegman/orgs","repos_url":"https://api.github.com/users/ltegman/repos","events_url":"https://api.github.com/users/ltegman/events{/privacy}","received_events_url":"https://api.github.com/users/ltegman/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T23:49:15Z","updated_at":"2015-11-06T23:49:15Z","body":"Looks really good. Only issue I'm seeing is that if a user hasn't linked up their GitHub the username will show up like the following example:\r\n```javascript\r\n// Bonfire: Reverse a String\r\n// Author: @fcca56baa66\r\n// Challenge: http://localhost:3000/challenges/bonfire-reverse-a-string\r\n// Learn to Code at Free Code Camp (www.freecodecamp.com)\r\n\r\n//This is a test\r\nfunction reverseString(str) {\r\n  return str.split('').reverse().join('');\r\n}\r\n\r\nreverseString(\"hello\");\r\n```\r\n\r\nAssuming it's not a huge amount of work it's probably worth removing that and posting as if they weren't logged in since it isn't meaningful, but I don't know that it's worth spending a lot of time on."}}