{"action":"created","comment":{"url":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/24060254","id":24060254,"diff_hunk":"@@ -0,0 +1,101 @@\n+var faker = require('faker');\r\n+\r\n+function shuffle(array) {\r\n+  var currentIndex = array.length, temporaryValue, randomIndex ;\r\n+\r\n+  // While there remain elements to shuffle...\r\n+  while (0 !== currentIndex) {\r\n+\r\n+    // Pick a remaining element...\r\n+    randomIndex = Math.floor(Math.random() * currentIndex);\r\n+    currentIndex -= 1;\r\n+\r\n+    // And swap it with the current element.\r\n+    temporaryValue = array[currentIndex];\r\n+    array[currentIndex] = array[randomIndex];\r\n+    array[randomIndex] = temporaryValue;\r\n+  }\r\n+\r\n+  return array;\r\n+}\r\n+\r\n+function getRandomColors() {\r\n+\tvar colors = ['violet', 'coral', 'cerise', 'wheat', 'red', 'blue', 'green'];\r\n+\tshuffle(colors);\r\n+\r\n+\tvar chosenColorQueue = Math.ceil(Math.random() * 3);\r\n+\treturn colors.slice(0, chosenColorQueue);\r\n+}\r\n+\r\n+// Models.\r\n+var Cat = require('../models/cat');\r\n+module.exports = {\r\n+\t\r\n+\tnewCat: function (req, res) {\r\n+\t\tvar randomAge = Math.round(Math.random() * 14) + 1;\r\n+\t\tvar randomName = faker.Name.firstName();\r\n+\t\tvar randomColors = getRandomColors();\r\n+\r\n+\t\tvar cat = new Cat({\r\n+\t\t\tage: randomAge,\r\n+\t\t\tname: randomName,\r\n+\t\t\tcolors: randomColors\r\n+\t\t});\r\n+\r\n+\t\tcat.save(function (err) {\r\n+\t\t  if (err) {\r\n+\t\t    console.log(\"Problem saving bob\", err);\r\n+\t\t  }\r\n+\t\t});\r\n+\r\n+\t\tres.send(\"Time to make a new cat!\");\r\n+\t},\r\n+\r\n+\tlistCatByAge: function (req, res) {\r\n+\r\n+\t\tCat.find()\r\n+\t\t\t.sort({age: 1})\r\n+\t\t  .exec(function(err, cats) {\r","path":"classes/class3/hdavidzhu_class3_homework/routes/cat-router.js","position":58,"original_position":58,"commit_id":"bb41e6ca27c646a88ffab8b3ec30edae10973428","original_commit_id":"bb41e6ca27c646a88ffab8b3ec30edae10973428","user":{"login":"benkahle","id":3596325,"avatar_url":"https://avatars.githubusercontent.com/u/3596325?v=3","gravatar_id":"","url":"https://api.github.com/users/benkahle","html_url":"https://github.com/benkahle","followers_url":"https://api.github.com/users/benkahle/followers","following_url":"https://api.github.com/users/benkahle/following{/other_user}","gists_url":"https://api.github.com/users/benkahle/gists{/gist_id}","starred_url":"https://api.github.com/users/benkahle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benkahle/subscriptions","organizations_url":"https://api.github.com/users/benkahle/orgs","repos_url":"https://api.github.com/users/benkahle/repos","events_url":"https://api.github.com/users/benkahle/events{/privacy}","received_events_url":"https://api.github.com/users/benkahle/received_events","type":"User","site_admin":false},"body":"You should intent this to match sort","created_at":"2015-02-04T03:12:19Z","updated_at":"2015-02-04T03:12:19Z","html_url":"https://github.com/olinjs/olinjs/pull/67#discussion_r24060254","pull_request_url":"https://api.github.com/repos/olinjs/olinjs/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/24060254"},"html":{"href":"https://github.com/olinjs/olinjs/pull/67#discussion_r24060254"},"pull_request":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/olinjs/olinjs/pulls/67","id":28609964,"html_url":"https://github.com/olinjs/olinjs/pull/67","diff_url":"https://github.com/olinjs/olinjs/pull/67.diff","patch_url":"https://github.com/olinjs/olinjs/pull/67.patch","issue_url":"https://api.github.com/repos/olinjs/olinjs/issues/67","number":67,"state":"open","locked":false,"title":"David - Homework 3","user":{"login":"benkahle","id":3596325,"avatar_url":"https://avatars.githubusercontent.com/u/3596325?v=3","gravatar_id":"","url":"https://api.github.com/users/benkahle","html_url":"https://github.com/benkahle","followers_url":"https://api.github.com/users/benkahle/followers","following_url":"https://api.github.com/users/benkahle/following{/other_user}","gists_url":"https://api.github.com/users/benkahle/gists{/gist_id}","starred_url":"https://api.github.com/users/benkahle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benkahle/subscriptions","organizations_url":"https://api.github.com/users/benkahle/orgs","repos_url":"https://api.github.com/users/benkahle/repos","events_url":"https://api.github.com/users/benkahle/events{/privacy}","received_events_url":"https://api.github.com/users/benkahle/received_events","type":"User","site_admin":false},"body":"Graded by: @Benkahle and @EvanDorsky ","created_at":"2015-02-04T03:03:05Z","updated_at":"2015-02-04T03:12:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb652232bbe8c0986120e1dea7ec0f7216b29a66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/olinjs/olinjs/pulls/67/commits","review_comments_url":"https://api.github.com/repos/olinjs/olinjs/pulls/67/comments","review_comment_url":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/{number}","comments_url":"https://api.github.com/repos/olinjs/olinjs/issues/67/comments","statuses_url":"https://api.github.com/repos/olinjs/olinjs/statuses/bb41e6ca27c646a88ffab8b3ec30edae10973428","head":{"label":"hdavidzhu:master","ref":"master","sha":"bb41e6ca27c646a88ffab8b3ec30edae10973428","user":{"login":"hdavidzhu","id":3756871,"avatar_url":"https://avatars.githubusercontent.com/u/3756871?v=3","gravatar_id":"","url":"https://api.github.com/users/hdavidzhu","html_url":"https://github.com/hdavidzhu","followers_url":"https://api.github.com/users/hdavidzhu/followers","following_url":"https://api.github.com/users/hdavidzhu/following{/other_user}","gists_url":"https://api.github.com/users/hdavidzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/hdavidzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdavidzhu/subscriptions","organizations_url":"https://api.github.com/users/hdavidzhu/orgs","repos_url":"https://api.github.com/users/hdavidzhu/repos","events_url":"https://api.github.com/users/hdavidzhu/events{/privacy}","received_events_url":"https://api.github.com/users/hdavidzhu/received_events","type":"User","site_admin":false},"repo":{"id":29231448,"name":"olinjs","full_name":"hdavidzhu/olinjs","owner":{"login":"hdavidzhu","id":3756871,"avatar_url":"https://avatars.githubusercontent.com/u/3756871?v=3","gravatar_id":"","url":"https://api.github.com/users/hdavidzhu","html_url":"https://github.com/hdavidzhu","followers_url":"https://api.github.com/users/hdavidzhu/followers","following_url":"https://api.github.com/users/hdavidzhu/following{/other_user}","gists_url":"https://api.github.com/users/hdavidzhu/gists{/gist_id}","starred_url":"https://api.github.com/users/hdavidzhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdavidzhu/subscriptions","organizations_url":"https://api.github.com/users/hdavidzhu/orgs","repos_url":"https://api.github.com/users/hdavidzhu/repos","events_url":"https://api.github.com/users/hdavidzhu/events{/privacy}","received_events_url":"https://api.github.com/users/hdavidzhu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hdavidzhu/olinjs","description":"The second offering of Olin.js in the spring of 2015","fork":true,"url":"https://api.github.com/repos/hdavidzhu/olinjs","forks_url":"https://api.github.com/repos/hdavidzhu/olinjs/forks","keys_url":"https://api.github.com/repos/hdavidzhu/olinjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hdavidzhu/olinjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hdavidzhu/olinjs/teams","hooks_url":"https://api.github.com/repos/hdavidzhu/olinjs/hooks","issue_events_url":"https://api.github.com/repos/hdavidzhu/olinjs/issues/events{/number}","events_url":"https://api.github.com/repos/hdavidzhu/olinjs/events","assignees_url":"https://api.github.com/repos/hdavidzhu/olinjs/assignees{/user}","branches_url":"https://api.github.com/repos/hdavidzhu/olinjs/branches{/branch}","tags_url":"https://api.github.com/repos/hdavidzhu/olinjs/tags","blobs_url":"https://api.github.com/repos/hdavidzhu/olinjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hdavidzhu/olinjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hdavidzhu/olinjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/hdavidzhu/olinjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hdavidzhu/olinjs/statuses/{sha}","languages_url":"https://api.github.com/repos/hdavidzhu/olinjs/languages","stargazers_url":"https://api.github.com/repos/hdavidzhu/olinjs/stargazers","contributors_url":"https://api.github.com/repos/hdavidzhu/olinjs/contributors","subscribers_url":"https://api.github.com/repos/hdavidzhu/olinjs/subscribers","subscription_url":"https://api.github.com/repos/hdavidzhu/olinjs/subscription","commits_url":"https://api.github.com/repos/hdavidzhu/olinjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/hdavidzhu/olinjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/hdavidzhu/olinjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/hdavidzhu/olinjs/issues/comments/{number}","contents_url":"https://api.github.com/repos/hdavidzhu/olinjs/contents/{+path}","compare_url":"https://api.github.com/repos/hdavidzhu/olinjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hdavidzhu/olinjs/merges","archive_url":"https://api.github.com/repos/hdavidzhu/olinjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hdavidzhu/olinjs/downloads","issues_url":"https://api.github.com/repos/hdavidzhu/olinjs/issues{/number}","pulls_url":"https://api.github.com/repos/hdavidzhu/olinjs/pulls{/number}","milestones_url":"https://api.github.com/repos/hdavidzhu/olinjs/milestones{/number}","notifications_url":"https://api.github.com/repos/hdavidzhu/olinjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hdavidzhu/olinjs/labels{/name}","releases_url":"https://api.github.com/repos/hdavidzhu/olinjs/releases{/id}","created_at":"2015-01-14T06:53:27Z","updated_at":"2015-01-30T16:36:49Z","pushed_at":"2015-02-03T20:40:40Z","git_url":"git://github.com/hdavidzhu/olinjs.git","ssh_url":"git@github.com:hdavidzhu/olinjs.git","clone_url":"https://github.com/hdavidzhu/olinjs.git","svn_url":"https://github.com/hdavidzhu/olinjs","homepage":null,"size":3389,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"olinjs:master","ref":"master","sha":"c7b21bb7b7f16985ccc21eecb41058cdebd8b3f4","user":{"login":"olinjs","id":3213751,"avatar_url":"https://avatars.githubusercontent.com/u/3213751?v=3","gravatar_id":"","url":"https://api.github.com/users/olinjs","html_url":"https://github.com/olinjs","followers_url":"https://api.github.com/users/olinjs/followers","following_url":"https://api.github.com/users/olinjs/following{/other_user}","gists_url":"https://api.github.com/users/olinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/olinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olinjs/subscriptions","organizations_url":"https://api.github.com/users/olinjs/orgs","repos_url":"https://api.github.com/users/olinjs/repos","events_url":"https://api.github.com/users/olinjs/events{/privacy}","received_events_url":"https://api.github.com/users/olinjs/received_events","type":"Organization","site_admin":false},"repo":{"id":28649083,"name":"olinjs","full_name":"olinjs/olinjs","owner":{"login":"olinjs","id":3213751,"avatar_url":"https://avatars.githubusercontent.com/u/3213751?v=3","gravatar_id":"","url":"https://api.github.com/users/olinjs","html_url":"https://github.com/olinjs","followers_url":"https://api.github.com/users/olinjs/followers","following_url":"https://api.github.com/users/olinjs/following{/other_user}","gists_url":"https://api.github.com/users/olinjs/gists{/gist_id}","starred_url":"https://api.github.com/users/olinjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olinjs/subscriptions","organizations_url":"https://api.github.com/users/olinjs/orgs","repos_url":"https://api.github.com/users/olinjs/repos","events_url":"https://api.github.com/users/olinjs/events{/privacy}","received_events_url":"https://api.github.com/users/olinjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/olinjs/olinjs","description":"The second offering of Olin.js in the spring of 2015","fork":false,"url":"https://api.github.com/repos/olinjs/olinjs","forks_url":"https://api.github.com/repos/olinjs/olinjs/forks","keys_url":"https://api.github.com/repos/olinjs/olinjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/olinjs/olinjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/olinjs/olinjs/teams","hooks_url":"https://api.github.com/repos/olinjs/olinjs/hooks","issue_events_url":"https://api.github.com/repos/olinjs/olinjs/issues/events{/number}","events_url":"https://api.github.com/repos/olinjs/olinjs/events","assignees_url":"https://api.github.com/repos/olinjs/olinjs/assignees{/user}","branches_url":"https://api.github.com/repos/olinjs/olinjs/branches{/branch}","tags_url":"https://api.github.com/repos/olinjs/olinjs/tags","blobs_url":"https://api.github.com/repos/olinjs/olinjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/olinjs/olinjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/olinjs/olinjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/olinjs/olinjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/olinjs/olinjs/statuses/{sha}","languages_url":"https://api.github.com/repos/olinjs/olinjs/languages","stargazers_url":"https://api.github.com/repos/olinjs/olinjs/stargazers","contributors_url":"https://api.github.com/repos/olinjs/olinjs/contributors","subscribers_url":"https://api.github.com/repos/olinjs/olinjs/subscribers","subscription_url":"https://api.github.com/repos/olinjs/olinjs/subscription","commits_url":"https://api.github.com/repos/olinjs/olinjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/olinjs/olinjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/olinjs/olinjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/olinjs/olinjs/issues/comments/{number}","contents_url":"https://api.github.com/repos/olinjs/olinjs/contents/{+path}","compare_url":"https://api.github.com/repos/olinjs/olinjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/olinjs/olinjs/merges","archive_url":"https://api.github.com/repos/olinjs/olinjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/olinjs/olinjs/downloads","issues_url":"https://api.github.com/repos/olinjs/olinjs/issues{/number}","pulls_url":"https://api.github.com/repos/olinjs/olinjs/pulls{/number}","milestones_url":"https://api.github.com/repos/olinjs/olinjs/milestones{/number}","notifications_url":"https://api.github.com/repos/olinjs/olinjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/olinjs/olinjs/labels{/name}","releases_url":"https://api.github.com/repos/olinjs/olinjs/releases{/id}","created_at":"2014-12-30T23:29:53Z","updated_at":"2015-02-03T16:34:33Z","pushed_at":"2015-02-03T20:36:45Z","git_url":"git://github.com/olinjs/olinjs.git","ssh_url":"git@github.com:olinjs/olinjs.git","clone_url":"https://github.com/olinjs/olinjs.git","svn_url":"https://github.com/olinjs/olinjs","homepage":null,"size":6076,"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":5,"forks":38,"open_issues":5,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/67"},"html":{"href":"https://github.com/olinjs/olinjs/pull/67"},"issue":{"href":"https://api.github.com/repos/olinjs/olinjs/issues/67"},"comments":{"href":"https://api.github.com/repos/olinjs/olinjs/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/olinjs/olinjs/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/olinjs/olinjs/statuses/bb41e6ca27c646a88ffab8b3ec30edae10973428"}}}}