{"action":"created","comment":{"url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/comments/52411907","id":52411907,"diff_hunk":"@@ -0,0 +1,103 @@\n+//  Wrap the entire contents of this file in an IIFE.\n+// Pass in to the IIFE a module, upon which objects can be attached for later access.\n+\n+(function(module){\n+  function Article (opts) {\n+    this.author = opts.author;\n+    this.authorUrl = opts.authorUrl;\n+    this.title = opts.title;\n+    this.category = opts.category;\n+    this.body = opts.body;\n+    this.publishedOn = opts.publishedOn;\n+  }\n+\n+  Article.all = [];\n+\n+  Article.prototype.toHtml = function() {\n+    var template = Handlebars.compile($('#article-template').text());\n+\n+    this.daysAgo = parseInt((new Date() - new Date(this.publishedOn))/60/60/24/1000);\n+    this.publishStatus = this.publishedOn ? 'published ' + this.daysAgo + ' days ago' : '(draft)';\n+    this.body = marked(this.body);\n+\n+    return template(this);\n+  };\n+\n+  Article.loadAll = function(rawData) {\n+    rawData.sort(function(a,b) {\n+      return (new Date(b.publishedOn)) - (new Date(a.publishedOn));\n+    });\n+\n+    // DONE: Refactor this forEach code, by using a `.map` call instead, since want we are trying to accomplish\n+    // is the transformation of one colleciton into another.\n+    // rawData.forEach(function(ele) {\n+    //   Article.all.push(new Article(ele));\n+    // })\n+    Article.all = rawData.map(function(ele) {\n+      return new Article(ele);\n+    });\n+  };\n+\n+  // This function will retrieve the data from either a local or remote source,\n+  // and process it, then hand off control to the View.\n+  //  Refactor this function, so it accepts an argument of a callback function (likely a view function)\n+  // to execute once the loading of articles is done.\n+  Article.fetchAll = function(callback) {\n+    if (localStorage.rawData) {\n+      Article.loadAll(JSON.parse(localStorage.rawData));\n+      callback();\n+    } else {\n+      $.getJSON('/data/hackerIpsum.json', function(rawData) {\n+        localStorage.rawData = JSON.stringify(rawData); // Cache the json, so we don't need to request it next time.\n+        Article.loadAll(JSON.parse(localStorage.rawData));\n+        callback();\n+      });\n+    }\n+  };\n+\n+\n+  // Chain together a `map` and a `reduce` call to get a rough count of all words in all articles.\n+  Article.numWordsAll = function() {\n+    return Article.all.map(function(article) {\n+      return article.body.split(' ').length;","path":"class-07-functional-programming/pair-assignment/frazier-dave/scripts/article.js","position":62,"original_position":62,"commit_id":"dd5bdbd1822ba7aa88c3d01f6e4de3e29c83f544","original_commit_id":"dd5bdbd1822ba7aa88c3d01f6e4de3e29c83f544","user":{"login":"patci","id":12869788,"avatar_url":"https://avatars.githubusercontent.com/u/12869788?v=3","gravatar_id":"","url":"https://api.github.com/users/patci","html_url":"https://github.com/patci","followers_url":"https://api.github.com/users/patci/followers","following_url":"https://api.github.com/users/patci/following{/other_user}","gists_url":"https://api.github.com/users/patci/gists{/gist_id}","starred_url":"https://api.github.com/users/patci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patci/subscriptions","organizations_url":"https://api.github.com/users/patci/orgs","repos_url":"https://api.github.com/users/patci/repos","events_url":"https://api.github.com/users/patci/events{/privacy}","received_events_url":"https://api.github.com/users/patci/received_events","type":"User","site_admin":false},"body":"Nice solution!","created_at":"2016-02-10T03:50:41Z","updated_at":"2016-02-10T03:50:41Z","html_url":"https://github.com/codefellows/seattle-301d5/pull/113#discussion_r52411907","pull_request_url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/comments/52411907"},"html":{"href":"https://github.com/codefellows/seattle-301d5/pull/113#discussion_r52411907"},"pull_request":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113","id":58819505,"html_url":"https://github.com/codefellows/seattle-301d5/pull/113","diff_url":"https://github.com/codefellows/seattle-301d5/pull/113.diff","patch_url":"https://github.com/codefellows/seattle-301d5/pull/113.patch","issue_url":"https://api.github.com/repos/codefellows/seattle-301d5/issues/113","number":113,"state":"open","locked":false,"title":"Class 07","user":{"login":"fraziermork","id":16546625,"avatar_url":"https://avatars.githubusercontent.com/u/16546625?v=3","gravatar_id":"","url":"https://api.github.com/users/fraziermork","html_url":"https://github.com/fraziermork","followers_url":"https://api.github.com/users/fraziermork/followers","following_url":"https://api.github.com/users/fraziermork/following{/other_user}","gists_url":"https://api.github.com/users/fraziermork/gists{/gist_id}","starred_url":"https://api.github.com/users/fraziermork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraziermork/subscriptions","organizations_url":"https://api.github.com/users/fraziermork/orgs","repos_url":"https://api.github.com/users/fraziermork/repos","events_url":"https://api.github.com/users/fraziermork/events{/privacy}","received_events_url":"https://api.github.com/users/fraziermork/received_events","type":"User","site_admin":false},"body":"Finished today's assignment and all todos. ","created_at":"2016-02-09T22:31:58Z","updated_at":"2016-02-10T03:50:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd059f011f3b9470a1a0dc484cc94a3eceb74835","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113/commits","review_comments_url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113/comments","review_comment_url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codefellows/seattle-301d5/issues/113/comments","statuses_url":"https://api.github.com/repos/codefellows/seattle-301d5/statuses/dd5bdbd1822ba7aa88c3d01f6e4de3e29c83f544","head":{"label":"fraziermork:class-07","ref":"class-07","sha":"dd5bdbd1822ba7aa88c3d01f6e4de3e29c83f544","user":{"login":"fraziermork","id":16546625,"avatar_url":"https://avatars.githubusercontent.com/u/16546625?v=3","gravatar_id":"","url":"https://api.github.com/users/fraziermork","html_url":"https://github.com/fraziermork","followers_url":"https://api.github.com/users/fraziermork/followers","following_url":"https://api.github.com/users/fraziermork/following{/other_user}","gists_url":"https://api.github.com/users/fraziermork/gists{/gist_id}","starred_url":"https://api.github.com/users/fraziermork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraziermork/subscriptions","organizations_url":"https://api.github.com/users/fraziermork/orgs","repos_url":"https://api.github.com/users/fraziermork/repos","events_url":"https://api.github.com/users/fraziermork/events{/privacy}","received_events_url":"https://api.github.com/users/fraziermork/received_events","type":"User","site_admin":false},"repo":{"id":50861601,"name":"seattle-301d5","full_name":"fraziermork/seattle-301d5","owner":{"login":"fraziermork","id":16546625,"avatar_url":"https://avatars.githubusercontent.com/u/16546625?v=3","gravatar_id":"","url":"https://api.github.com/users/fraziermork","html_url":"https://github.com/fraziermork","followers_url":"https://api.github.com/users/fraziermork/followers","following_url":"https://api.github.com/users/fraziermork/following{/other_user}","gists_url":"https://api.github.com/users/fraziermork/gists{/gist_id}","starred_url":"https://api.github.com/users/fraziermork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fraziermork/subscriptions","organizations_url":"https://api.github.com/users/fraziermork/orgs","repos_url":"https://api.github.com/users/fraziermork/repos","events_url":"https://api.github.com/users/fraziermork/events{/privacy}","received_events_url":"https://api.github.com/users/fraziermork/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fraziermork/seattle-301d5","description":"Code 301: Intermediate Software Development","fork":true,"url":"https://api.github.com/repos/fraziermork/seattle-301d5","forks_url":"https://api.github.com/repos/fraziermork/seattle-301d5/forks","keys_url":"https://api.github.com/repos/fraziermork/seattle-301d5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fraziermork/seattle-301d5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fraziermork/seattle-301d5/teams","hooks_url":"https://api.github.com/repos/fraziermork/seattle-301d5/hooks","issue_events_url":"https://api.github.com/repos/fraziermork/seattle-301d5/issues/events{/number}","events_url":"https://api.github.com/repos/fraziermork/seattle-301d5/events","assignees_url":"https://api.github.com/repos/fraziermork/seattle-301d5/assignees{/user}","branches_url":"https://api.github.com/repos/fraziermork/seattle-301d5/branches{/branch}","tags_url":"https://api.github.com/repos/fraziermork/seattle-301d5/tags","blobs_url":"https://api.github.com/repos/fraziermork/seattle-301d5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fraziermork/seattle-301d5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fraziermork/seattle-301d5/git/refs{/sha}","trees_url":"https://api.github.com/repos/fraziermork/seattle-301d5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fraziermork/seattle-301d5/statuses/{sha}","languages_url":"https://api.github.com/repos/fraziermork/seattle-301d5/languages","stargazers_url":"https://api.github.com/repos/fraziermork/seattle-301d5/stargazers","contributors_url":"https://api.github.com/repos/fraziermork/seattle-301d5/contributors","subscribers_url":"https://api.github.com/repos/fraziermork/seattle-301d5/subscribers","subscription_url":"https://api.github.com/repos/fraziermork/seattle-301d5/subscription","commits_url":"https://api.github.com/repos/fraziermork/seattle-301d5/commits{/sha}","git_commits_url":"https://api.github.com/repos/fraziermork/seattle-301d5/git/commits{/sha}","comments_url":"https://api.github.com/repos/fraziermork/seattle-301d5/comments{/number}","issue_comment_url":"https://api.github.com/repos/fraziermork/seattle-301d5/issues/comments{/number}","contents_url":"https://api.github.com/repos/fraziermork/seattle-301d5/contents/{+path}","compare_url":"https://api.github.com/repos/fraziermork/seattle-301d5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fraziermork/seattle-301d5/merges","archive_url":"https://api.github.com/repos/fraziermork/seattle-301d5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fraziermork/seattle-301d5/downloads","issues_url":"https://api.github.com/repos/fraziermork/seattle-301d5/issues{/number}","pulls_url":"https://api.github.com/repos/fraziermork/seattle-301d5/pulls{/number}","milestones_url":"https://api.github.com/repos/fraziermork/seattle-301d5/milestones{/number}","notifications_url":"https://api.github.com/repos/fraziermork/seattle-301d5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fraziermork/seattle-301d5/labels{/name}","releases_url":"https://api.github.com/repos/fraziermork/seattle-301d5/releases{/id}","deployments_url":"https://api.github.com/repos/fraziermork/seattle-301d5/deployments","created_at":"2016-02-01T18:40:16Z","updated_at":"2016-02-01T18:40:19Z","pushed_at":"2016-02-09T22:31:08Z","git_url":"git://github.com/fraziermork/seattle-301d5.git","ssh_url":"git@github.com:fraziermork/seattle-301d5.git","clone_url":"https://github.com/fraziermork/seattle-301d5.git","svn_url":"https://github.com/fraziermork/seattle-301d5","homepage":null,"size":2504,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"codefellows:master","ref":"master","sha":"af6f2e9fbb7e3489540d2abb9aa173ce42d89d33","user":{"login":"codefellows","id":3904529,"avatar_url":"https://avatars.githubusercontent.com/u/3904529?v=3","gravatar_id":"","url":"https://api.github.com/users/codefellows","html_url":"https://github.com/codefellows","followers_url":"https://api.github.com/users/codefellows/followers","following_url":"https://api.github.com/users/codefellows/following{/other_user}","gists_url":"https://api.github.com/users/codefellows/gists{/gist_id}","starred_url":"https://api.github.com/users/codefellows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codefellows/subscriptions","organizations_url":"https://api.github.com/users/codefellows/orgs","repos_url":"https://api.github.com/users/codefellows/repos","events_url":"https://api.github.com/users/codefellows/events{/privacy}","received_events_url":"https://api.github.com/users/codefellows/received_events","type":"Organization","site_admin":false},"repo":{"id":50859604,"name":"seattle-301d5","full_name":"codefellows/seattle-301d5","owner":{"login":"codefellows","id":3904529,"avatar_url":"https://avatars.githubusercontent.com/u/3904529?v=3","gravatar_id":"","url":"https://api.github.com/users/codefellows","html_url":"https://github.com/codefellows","followers_url":"https://api.github.com/users/codefellows/followers","following_url":"https://api.github.com/users/codefellows/following{/other_user}","gists_url":"https://api.github.com/users/codefellows/gists{/gist_id}","starred_url":"https://api.github.com/users/codefellows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codefellows/subscriptions","organizations_url":"https://api.github.com/users/codefellows/orgs","repos_url":"https://api.github.com/users/codefellows/repos","events_url":"https://api.github.com/users/codefellows/events{/privacy}","received_events_url":"https://api.github.com/users/codefellows/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codefellows/seattle-301d5","description":"Code 301: Intermediate Software Development","fork":false,"url":"https://api.github.com/repos/codefellows/seattle-301d5","forks_url":"https://api.github.com/repos/codefellows/seattle-301d5/forks","keys_url":"https://api.github.com/repos/codefellows/seattle-301d5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codefellows/seattle-301d5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codefellows/seattle-301d5/teams","hooks_url":"https://api.github.com/repos/codefellows/seattle-301d5/hooks","issue_events_url":"https://api.github.com/repos/codefellows/seattle-301d5/issues/events{/number}","events_url":"https://api.github.com/repos/codefellows/seattle-301d5/events","assignees_url":"https://api.github.com/repos/codefellows/seattle-301d5/assignees{/user}","branches_url":"https://api.github.com/repos/codefellows/seattle-301d5/branches{/branch}","tags_url":"https://api.github.com/repos/codefellows/seattle-301d5/tags","blobs_url":"https://api.github.com/repos/codefellows/seattle-301d5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codefellows/seattle-301d5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codefellows/seattle-301d5/git/refs{/sha}","trees_url":"https://api.github.com/repos/codefellows/seattle-301d5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codefellows/seattle-301d5/statuses/{sha}","languages_url":"https://api.github.com/repos/codefellows/seattle-301d5/languages","stargazers_url":"https://api.github.com/repos/codefellows/seattle-301d5/stargazers","contributors_url":"https://api.github.com/repos/codefellows/seattle-301d5/contributors","subscribers_url":"https://api.github.com/repos/codefellows/seattle-301d5/subscribers","subscription_url":"https://api.github.com/repos/codefellows/seattle-301d5/subscription","commits_url":"https://api.github.com/repos/codefellows/seattle-301d5/commits{/sha}","git_commits_url":"https://api.github.com/repos/codefellows/seattle-301d5/git/commits{/sha}","comments_url":"https://api.github.com/repos/codefellows/seattle-301d5/comments{/number}","issue_comment_url":"https://api.github.com/repos/codefellows/seattle-301d5/issues/comments{/number}","contents_url":"https://api.github.com/repos/codefellows/seattle-301d5/contents/{+path}","compare_url":"https://api.github.com/repos/codefellows/seattle-301d5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codefellows/seattle-301d5/merges","archive_url":"https://api.github.com/repos/codefellows/seattle-301d5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codefellows/seattle-301d5/downloads","issues_url":"https://api.github.com/repos/codefellows/seattle-301d5/issues{/number}","pulls_url":"https://api.github.com/repos/codefellows/seattle-301d5/pulls{/number}","milestones_url":"https://api.github.com/repos/codefellows/seattle-301d5/milestones{/number}","notifications_url":"https://api.github.com/repos/codefellows/seattle-301d5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codefellows/seattle-301d5/labels{/name}","releases_url":"https://api.github.com/repos/codefellows/seattle-301d5/releases{/id}","deployments_url":"https://api.github.com/repos/codefellows/seattle-301d5/deployments","created_at":"2016-02-01T18:09:11Z","updated_at":"2016-02-04T19:31:28Z","pushed_at":"2016-02-10T02:57:29Z","git_url":"git://github.com/codefellows/seattle-301d5.git","ssh_url":"git@github.com:codefellows/seattle-301d5.git","clone_url":"https://github.com/codefellows/seattle-301d5.git","svn_url":"https://github.com/codefellows/seattle-301d5","homepage":null,"size":3115,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":117,"forks":38,"open_issues":117,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113"},"html":{"href":"https://github.com/codefellows/seattle-301d5/pull/113"},"issue":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/issues/113"},"comments":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/codefellows/seattle-301d5/statuses/dd5bdbd1822ba7aa88c3d01f6e4de3e29c83f544"}}}}