{"action":"created","comment":{"url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/comments/81500976","pull_request_review_id":2476330,"id":81500976,"diff_hunk":"@@ -0,0 +1,255 @@\n+'use strict';\n+\n+var App = App || {};\n+\n+// Let's get started!\n+App.settings = (function($, App) { \n+  /**\n+   * Preload all recipes\n+   * Using async:false here since it's a small json file, in a real world scenario \n+   * where data could be much larger, the call should be async.\n+   * \n+   * @return {Array} Array of recipes\n+   */\n+  function fetchRecipes() {\n+    var recipes;\n+\n+    var yay = function(response) {\n+      recipes = response;\n+    };\n+\n+    var nah = function() {\n+      console.log('Json? Are you there?');\n+    };\n+\n+    $.ajax({\n+      url: '/recipes.json',\n+      async: false, \n+      dataType: 'json', \n+      success: yay,\n+      error: nah\n+    });\n+\n+    return recipes;\n+  };\n+\n+  return {\n+    data: fetchRecipes(),\n+    $el: $('#app'),\n+    $recipesContainer: $('.js-recipes'),\n+    $ingredientsContainer: $('.js-ingredients'),\n+    $filterContainer: $('.js-filter select')\n+  } \n+})(jQuery, App);\n+\n+// Ingredients\n+App.ingredients = (function($, App) {\n+  var _removeRepeatedIngredients = function(ingredient, index, arr) {\n+    return index === arr.indexOf(ingredient);\n+  };\n+\n+  var renderFilter = function() {\n+    // Get all ingredients from recipes\n+    var ingredients = App.settings.data.map(function(recipe) {\n+      return recipe.ingredients;\n+    });\n+\n+    // Flatten, sort and remove repeated ingredients\n+    ingredients = [].concat.apply([], ingredients).sort().filter(_removeRepeatedIngredients);\n+\n+    // Inject a default option for any ingredient\n+    App.settings.$filterContainer.prepend($('<option>', { text: 'Any ingredient', value: 'Any' }));\n+\n+    var _renderIngredientOption = function(ingredient) {\n+      $('<option />', { text: ingredient, value: ingredient }).appendTo(App.settings.$filterContainer);\n+    };\n+\n+    var _bindSelect = function() {\n+      App.settings.$filterContainer.on('change', function() {\n+        if (this.value === 'Any') {\n+          App.recipes.renderRecipes();\n+        } else {\n+          App.recipes.renderRecipes({\n+            savedIngredient: this.value\n+          });\n+        }\n+\n+        // Reset ingredients list\n+        App.ingredients.renderIngredients();\n+\n+        // Save it to localStorage\n+        App.ingredients.saveFilter(this.value);\n+      });\n+    };\n+\n+    // Render the ingredients dropdown\n+    ingredients.map(function(ingredient) {\n+      _renderIngredientOption(ingredient);\n+    });\n+\n+    // Bind filter select\n+    _bindSelect();\n+\n+    $('.js-showAll').on('click', function() {\n+      App.recipes.renderRecipes();\n+      $('option[value=\"Any\"]', App.settings.$filterContainer).prop('selected', true);\n+      App.ingredients.saveFilter('Any');\n+\n+      return false;\n+    });\n+  };\n+\n+  var renderIngredients = function($checkbox) {\n+    // Active ingredients holder\n+    var activeIngredients = [];\n+\n+    // Clear all current ingredients in the DOM\n+    App.settings.$ingredientsContainer.empty();\n+\n+    if ($checkbox) {\n+      if ($checkbox.is(':checked')) {\n+        // Get ingredients for the selected recipe\n+        var selectedIngredients = App.recipes.getRecipe($checkbox.val()).ingredients;","path":"jquery/v2/app.js","position":112,"original_position":112,"commit_id":"6e1ac34785607dc446f17b25ad9b2ec0a0c77174","original_commit_id":"6e1ac34785607dc446f17b25ad9b2ec0a0c77174","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Line is too long.","created_at":"2016-10-03T07:26:23Z","updated_at":"2016-10-03T07:26:23Z","html_url":"https://github.com/chhuang/frontend-code-test/pull/1#discussion_r81500976","pull_request_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/comments/81500976"},"html":{"href":"https://github.com/chhuang/frontend-code-test/pull/1#discussion_r81500976"},"pull_request":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1","id":86460948,"html_url":"https://github.com/chhuang/frontend-code-test/pull/1","diff_url":"https://github.com/chhuang/frontend-code-test/pull/1.diff","patch_url":"https://github.com/chhuang/frontend-code-test/pull/1.patch","issue_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/1","number":1,"state":"open","locked":false,"title":"Testing Hound","user":{"login":"chhuang","id":78710,"avatar_url":"https://avatars.githubusercontent.com/u/78710?v=3","gravatar_id":"","url":"https://api.github.com/users/chhuang","html_url":"https://github.com/chhuang","followers_url":"https://api.github.com/users/chhuang/followers","following_url":"https://api.github.com/users/chhuang/following{/other_user}","gists_url":"https://api.github.com/users/chhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/chhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chhuang/subscriptions","organizations_url":"https://api.github.com/users/chhuang/orgs","repos_url":"https://api.github.com/users/chhuang/repos","events_url":"https://api.github.com/users/chhuang/events{/privacy}","received_events_url":"https://api.github.com/users/chhuang/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-23T06:39:32Z","updated_at":"2016-10-03T07:26:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e3b5d28de1c80a923ae01e9c9c62684d60b39d9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1/commits","review_comments_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1/comments","review_comment_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/1/comments","statuses_url":"https://api.github.com/repos/chhuang/frontend-code-test/statuses/6e1ac34785607dc446f17b25ad9b2ec0a0c77174","head":{"label":"chhuang:dev","ref":"dev","sha":"6e1ac34785607dc446f17b25ad9b2ec0a0c77174","user":{"login":"chhuang","id":78710,"avatar_url":"https://avatars.githubusercontent.com/u/78710?v=3","gravatar_id":"","url":"https://api.github.com/users/chhuang","html_url":"https://github.com/chhuang","followers_url":"https://api.github.com/users/chhuang/followers","following_url":"https://api.github.com/users/chhuang/following{/other_user}","gists_url":"https://api.github.com/users/chhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/chhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chhuang/subscriptions","organizations_url":"https://api.github.com/users/chhuang/orgs","repos_url":"https://api.github.com/users/chhuang/repos","events_url":"https://api.github.com/users/chhuang/events{/privacy}","received_events_url":"https://api.github.com/users/chhuang/received_events","type":"User","site_admin":false},"repo":{"id":60130537,"name":"frontend-code-test","full_name":"chhuang/frontend-code-test","owner":{"login":"chhuang","id":78710,"avatar_url":"https://avatars.githubusercontent.com/u/78710?v=3","gravatar_id":"","url":"https://api.github.com/users/chhuang","html_url":"https://github.com/chhuang","followers_url":"https://api.github.com/users/chhuang/followers","following_url":"https://api.github.com/users/chhuang/following{/other_user}","gists_url":"https://api.github.com/users/chhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/chhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chhuang/subscriptions","organizations_url":"https://api.github.com/users/chhuang/orgs","repos_url":"https://api.github.com/users/chhuang/repos","events_url":"https://api.github.com/users/chhuang/events{/privacy}","received_events_url":"https://api.github.com/users/chhuang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chhuang/frontend-code-test","description":"DataScience's current at-home test for Frontend Developers","fork":true,"url":"https://api.github.com/repos/chhuang/frontend-code-test","forks_url":"https://api.github.com/repos/chhuang/frontend-code-test/forks","keys_url":"https://api.github.com/repos/chhuang/frontend-code-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chhuang/frontend-code-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chhuang/frontend-code-test/teams","hooks_url":"https://api.github.com/repos/chhuang/frontend-code-test/hooks","issue_events_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/events{/number}","events_url":"https://api.github.com/repos/chhuang/frontend-code-test/events","assignees_url":"https://api.github.com/repos/chhuang/frontend-code-test/assignees{/user}","branches_url":"https://api.github.com/repos/chhuang/frontend-code-test/branches{/branch}","tags_url":"https://api.github.com/repos/chhuang/frontend-code-test/tags","blobs_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chhuang/frontend-code-test/statuses/{sha}","languages_url":"https://api.github.com/repos/chhuang/frontend-code-test/languages","stargazers_url":"https://api.github.com/repos/chhuang/frontend-code-test/stargazers","contributors_url":"https://api.github.com/repos/chhuang/frontend-code-test/contributors","subscribers_url":"https://api.github.com/repos/chhuang/frontend-code-test/subscribers","subscription_url":"https://api.github.com/repos/chhuang/frontend-code-test/subscription","commits_url":"https://api.github.com/repos/chhuang/frontend-code-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/chhuang/frontend-code-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/chhuang/frontend-code-test/contents/{+path}","compare_url":"https://api.github.com/repos/chhuang/frontend-code-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chhuang/frontend-code-test/merges","archive_url":"https://api.github.com/repos/chhuang/frontend-code-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chhuang/frontend-code-test/downloads","issues_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues{/number}","pulls_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls{/number}","milestones_url":"https://api.github.com/repos/chhuang/frontend-code-test/milestones{/number}","notifications_url":"https://api.github.com/repos/chhuang/frontend-code-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chhuang/frontend-code-test/labels{/name}","releases_url":"https://api.github.com/repos/chhuang/frontend-code-test/releases{/id}","deployments_url":"https://api.github.com/repos/chhuang/frontend-code-test/deployments","created_at":"2016-05-31T23:30:03Z","updated_at":"2016-06-01T12:43:14Z","pushed_at":"2016-10-03T07:26:16Z","git_url":"git://github.com/chhuang/frontend-code-test.git","ssh_url":"git@github.com:chhuang/frontend-code-test.git","clone_url":"https://github.com/chhuang/frontend-code-test.git","svn_url":"https://github.com/chhuang/frontend-code-test","homepage":"","size":154,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"chhuang:master","ref":"master","sha":"b29fe976c79d8de7633d588a3144b26a10529c12","user":{"login":"chhuang","id":78710,"avatar_url":"https://avatars.githubusercontent.com/u/78710?v=3","gravatar_id":"","url":"https://api.github.com/users/chhuang","html_url":"https://github.com/chhuang","followers_url":"https://api.github.com/users/chhuang/followers","following_url":"https://api.github.com/users/chhuang/following{/other_user}","gists_url":"https://api.github.com/users/chhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/chhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chhuang/subscriptions","organizations_url":"https://api.github.com/users/chhuang/orgs","repos_url":"https://api.github.com/users/chhuang/repos","events_url":"https://api.github.com/users/chhuang/events{/privacy}","received_events_url":"https://api.github.com/users/chhuang/received_events","type":"User","site_admin":false},"repo":{"id":60130537,"name":"frontend-code-test","full_name":"chhuang/frontend-code-test","owner":{"login":"chhuang","id":78710,"avatar_url":"https://avatars.githubusercontent.com/u/78710?v=3","gravatar_id":"","url":"https://api.github.com/users/chhuang","html_url":"https://github.com/chhuang","followers_url":"https://api.github.com/users/chhuang/followers","following_url":"https://api.github.com/users/chhuang/following{/other_user}","gists_url":"https://api.github.com/users/chhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/chhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chhuang/subscriptions","organizations_url":"https://api.github.com/users/chhuang/orgs","repos_url":"https://api.github.com/users/chhuang/repos","events_url":"https://api.github.com/users/chhuang/events{/privacy}","received_events_url":"https://api.github.com/users/chhuang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chhuang/frontend-code-test","description":"DataScience's current at-home test for Frontend Developers","fork":true,"url":"https://api.github.com/repos/chhuang/frontend-code-test","forks_url":"https://api.github.com/repos/chhuang/frontend-code-test/forks","keys_url":"https://api.github.com/repos/chhuang/frontend-code-test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chhuang/frontend-code-test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chhuang/frontend-code-test/teams","hooks_url":"https://api.github.com/repos/chhuang/frontend-code-test/hooks","issue_events_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/events{/number}","events_url":"https://api.github.com/repos/chhuang/frontend-code-test/events","assignees_url":"https://api.github.com/repos/chhuang/frontend-code-test/assignees{/user}","branches_url":"https://api.github.com/repos/chhuang/frontend-code-test/branches{/branch}","tags_url":"https://api.github.com/repos/chhuang/frontend-code-test/tags","blobs_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/refs{/sha}","trees_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chhuang/frontend-code-test/statuses/{sha}","languages_url":"https://api.github.com/repos/chhuang/frontend-code-test/languages","stargazers_url":"https://api.github.com/repos/chhuang/frontend-code-test/stargazers","contributors_url":"https://api.github.com/repos/chhuang/frontend-code-test/contributors","subscribers_url":"https://api.github.com/repos/chhuang/frontend-code-test/subscribers","subscription_url":"https://api.github.com/repos/chhuang/frontend-code-test/subscription","commits_url":"https://api.github.com/repos/chhuang/frontend-code-test/commits{/sha}","git_commits_url":"https://api.github.com/repos/chhuang/frontend-code-test/git/commits{/sha}","comments_url":"https://api.github.com/repos/chhuang/frontend-code-test/comments{/number}","issue_comment_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues/comments{/number}","contents_url":"https://api.github.com/repos/chhuang/frontend-code-test/contents/{+path}","compare_url":"https://api.github.com/repos/chhuang/frontend-code-test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chhuang/frontend-code-test/merges","archive_url":"https://api.github.com/repos/chhuang/frontend-code-test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chhuang/frontend-code-test/downloads","issues_url":"https://api.github.com/repos/chhuang/frontend-code-test/issues{/number}","pulls_url":"https://api.github.com/repos/chhuang/frontend-code-test/pulls{/number}","milestones_url":"https://api.github.com/repos/chhuang/frontend-code-test/milestones{/number}","notifications_url":"https://api.github.com/repos/chhuang/frontend-code-test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chhuang/frontend-code-test/labels{/name}","releases_url":"https://api.github.com/repos/chhuang/frontend-code-test/releases{/id}","deployments_url":"https://api.github.com/repos/chhuang/frontend-code-test/deployments","created_at":"2016-05-31T23:30:03Z","updated_at":"2016-06-01T12:43:14Z","pushed_at":"2016-10-03T07:26:16Z","git_url":"git://github.com/chhuang/frontend-code-test.git","ssh_url":"git@github.com:chhuang/frontend-code-test.git","clone_url":"https://github.com/chhuang/frontend-code-test.git","svn_url":"https://github.com/chhuang/frontend-code-test","homepage":"","size":154,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1"},"html":{"href":"https://github.com/chhuang/frontend-code-test/pull/1"},"issue":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/issues/1"},"comments":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/chhuang/frontend-code-test/statuses/6e1ac34785607dc446f17b25ad9b2ec0a0c77174"}}}}
{"actor":{"display_login":"houndci-bot"}}