{"action":"created","comment":{"url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/comments/75987390","id":75987390,"diff_hunk":"@@ -0,0 +1,60 @@\n+/**\n+ * A priority queue stores a list of items but each can have a numeric priority value.\n+ * Items with a higher priority are dequeued before items with a lower priority.\n+ * Implemented as a hash of arrays where the hash keys are priority values.\n+ */\n+function PriorityQueue(size) {\n+\tthis.store = {};\t// keys are priorities, values are arrays of elements\n+\tthis.count = 0;\n+\n+\t// adds an item\n+\t// priority must be an integer (higher value has higher priority)\n+\tthis.add = function(value, priority) {\n+\t\tif (this.store[priority] == undefined)\n+\t\t\tthis.store[priority] = [];\n+\n+\t\tthis.store[priority].push(value);\n+\t\tthis.count++;\n+\t};\n+\n+\t// returns the oldest-added value with the highest priority\n+\tthis.Pop = function() {\n+\t\tmaxKey = Math.max(Object.keys(this.store));\n+\t\tthis.count--;\n+\t\treturn this.store[maxKey].shift();\n+\t};\n+\n+\tthis.length = function() {\n+\t\treturn this.count;\n+\t}\n+}\n+\n+PriorityQueue.prototype.get_all_priorities = function() {\n+\treturn Object.keys(this.store);\n+}\n+\n+// iterates through all the queue elements in priority-then-FIFO order\n+PriorityQueue.prototype.forEach = function(callback) {\n+\tvar keys = Object.keys(this.store).sort();\n+\n+\tfor (var a = keys.length; a > 0; a--) {\n+\t\tfor (var b = 0; b < this.store[a].length; b++)\n+\t\t\tcallback(this.store[a][b]);\n+\t}\n+}\n+\n+PriorityQueue.prototype.changePriority = function(value, newPriority) {\n+\tvar foundItem = false;\n+\n+\tthis.store.forEach(function(bucket) {\n+\t\tbucket.forEach(function(item, index) {\n+\t\t\tif (item === value) {\n+\t\t\t\tbucket.splice(index, 1);  // remove the item\n+\t\t\t\tthis.add(value, newPriority);\n+\t\t\t\tfoundItem = true;\n+\t\t\t\treturn false;  // early exit from forEach\n+\t\t\t}\n+\t\t});\n+\t\tif (foundItem) return false;","path":"rags.js","position":58,"original_position":58,"commit_id":"4f30921b4e478caa77eac8df2dc60e8688ccffa2","original_commit_id":"4f30921b4e478caa77eac8df2dc60e8688ccffa2","user":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"body":"you can just return foundItem here","created_at":"2016-08-24T02:50:18Z","updated_at":"2016-08-24T02:50:18Z","html_url":"https://github.com/prateekmadhikar/temp/pull/1#discussion_r75987390","pull_request_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/comments/75987390"},"html":{"href":"https://github.com/prateekmadhikar/temp/pull/1#discussion_r75987390"},"pull_request":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1","id":82470714,"html_url":"https://github.com/prateekmadhikar/temp/pull/1","diff_url":"https://github.com/prateekmadhikar/temp/pull/1.diff","patch_url":"https://github.com/prateekmadhikar/temp/pull/1.patch","issue_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/1","number":1,"state":"open","locked":false,"title":"delete","user":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-24T02:06:49Z","updated_at":"2016-08-24T02:50:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9537cfec63a66b36120501323265cc8b4d036c4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1/commits","review_comments_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1/comments","review_comment_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/1/comments","statuses_url":"https://api.github.com/repos/prateekmadhikar/temp/statuses/4f30921b4e478caa77eac8df2dc60e8688ccffa2","head":{"label":"prateekmadhikar:rags","ref":"rags","sha":"4f30921b4e478caa77eac8df2dc60e8688ccffa2","user":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"repo":{"id":66419934,"name":"temp","full_name":"prateekmadhikar/temp","owner":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prateekmadhikar/temp","description":null,"fork":false,"url":"https://api.github.com/repos/prateekmadhikar/temp","forks_url":"https://api.github.com/repos/prateekmadhikar/temp/forks","keys_url":"https://api.github.com/repos/prateekmadhikar/temp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prateekmadhikar/temp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prateekmadhikar/temp/teams","hooks_url":"https://api.github.com/repos/prateekmadhikar/temp/hooks","issue_events_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/events{/number}","events_url":"https://api.github.com/repos/prateekmadhikar/temp/events","assignees_url":"https://api.github.com/repos/prateekmadhikar/temp/assignees{/user}","branches_url":"https://api.github.com/repos/prateekmadhikar/temp/branches{/branch}","tags_url":"https://api.github.com/repos/prateekmadhikar/temp/tags","blobs_url":"https://api.github.com/repos/prateekmadhikar/temp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prateekmadhikar/temp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prateekmadhikar/temp/git/refs{/sha}","trees_url":"https://api.github.com/repos/prateekmadhikar/temp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prateekmadhikar/temp/statuses/{sha}","languages_url":"https://api.github.com/repos/prateekmadhikar/temp/languages","stargazers_url":"https://api.github.com/repos/prateekmadhikar/temp/stargazers","contributors_url":"https://api.github.com/repos/prateekmadhikar/temp/contributors","subscribers_url":"https://api.github.com/repos/prateekmadhikar/temp/subscribers","subscription_url":"https://api.github.com/repos/prateekmadhikar/temp/subscription","commits_url":"https://api.github.com/repos/prateekmadhikar/temp/commits{/sha}","git_commits_url":"https://api.github.com/repos/prateekmadhikar/temp/git/commits{/sha}","comments_url":"https://api.github.com/repos/prateekmadhikar/temp/comments{/number}","issue_comment_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/comments{/number}","contents_url":"https://api.github.com/repos/prateekmadhikar/temp/contents/{+path}","compare_url":"https://api.github.com/repos/prateekmadhikar/temp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prateekmadhikar/temp/merges","archive_url":"https://api.github.com/repos/prateekmadhikar/temp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prateekmadhikar/temp/downloads","issues_url":"https://api.github.com/repos/prateekmadhikar/temp/issues{/number}","pulls_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls{/number}","milestones_url":"https://api.github.com/repos/prateekmadhikar/temp/milestones{/number}","notifications_url":"https://api.github.com/repos/prateekmadhikar/temp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prateekmadhikar/temp/labels{/name}","releases_url":"https://api.github.com/repos/prateekmadhikar/temp/releases{/id}","deployments_url":"https://api.github.com/repos/prateekmadhikar/temp/deployments","created_at":"2016-08-24T02:04:02Z","updated_at":"2016-08-24T02:04:02Z","pushed_at":"2016-08-24T02:07:29Z","git_url":"git://github.com/prateekmadhikar/temp.git","ssh_url":"git@github.com:prateekmadhikar/temp.git","clone_url":"https://github.com/prateekmadhikar/temp.git","svn_url":"https://github.com/prateekmadhikar/temp","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"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":"prateekmadhikar:master","ref":"master","sha":"59754e7ff5d57ad4229e10956e088defe32f4db6","user":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"repo":{"id":66419934,"name":"temp","full_name":"prateekmadhikar/temp","owner":{"login":"prateekmadhikar","id":4978606,"avatar_url":"https://avatars.githubusercontent.com/u/4978606?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekmadhikar","html_url":"https://github.com/prateekmadhikar","followers_url":"https://api.github.com/users/prateekmadhikar/followers","following_url":"https://api.github.com/users/prateekmadhikar/following{/other_user}","gists_url":"https://api.github.com/users/prateekmadhikar/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekmadhikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekmadhikar/subscriptions","organizations_url":"https://api.github.com/users/prateekmadhikar/orgs","repos_url":"https://api.github.com/users/prateekmadhikar/repos","events_url":"https://api.github.com/users/prateekmadhikar/events{/privacy}","received_events_url":"https://api.github.com/users/prateekmadhikar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prateekmadhikar/temp","description":null,"fork":false,"url":"https://api.github.com/repos/prateekmadhikar/temp","forks_url":"https://api.github.com/repos/prateekmadhikar/temp/forks","keys_url":"https://api.github.com/repos/prateekmadhikar/temp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prateekmadhikar/temp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prateekmadhikar/temp/teams","hooks_url":"https://api.github.com/repos/prateekmadhikar/temp/hooks","issue_events_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/events{/number}","events_url":"https://api.github.com/repos/prateekmadhikar/temp/events","assignees_url":"https://api.github.com/repos/prateekmadhikar/temp/assignees{/user}","branches_url":"https://api.github.com/repos/prateekmadhikar/temp/branches{/branch}","tags_url":"https://api.github.com/repos/prateekmadhikar/temp/tags","blobs_url":"https://api.github.com/repos/prateekmadhikar/temp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prateekmadhikar/temp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prateekmadhikar/temp/git/refs{/sha}","trees_url":"https://api.github.com/repos/prateekmadhikar/temp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prateekmadhikar/temp/statuses/{sha}","languages_url":"https://api.github.com/repos/prateekmadhikar/temp/languages","stargazers_url":"https://api.github.com/repos/prateekmadhikar/temp/stargazers","contributors_url":"https://api.github.com/repos/prateekmadhikar/temp/contributors","subscribers_url":"https://api.github.com/repos/prateekmadhikar/temp/subscribers","subscription_url":"https://api.github.com/repos/prateekmadhikar/temp/subscription","commits_url":"https://api.github.com/repos/prateekmadhikar/temp/commits{/sha}","git_commits_url":"https://api.github.com/repos/prateekmadhikar/temp/git/commits{/sha}","comments_url":"https://api.github.com/repos/prateekmadhikar/temp/comments{/number}","issue_comment_url":"https://api.github.com/repos/prateekmadhikar/temp/issues/comments{/number}","contents_url":"https://api.github.com/repos/prateekmadhikar/temp/contents/{+path}","compare_url":"https://api.github.com/repos/prateekmadhikar/temp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prateekmadhikar/temp/merges","archive_url":"https://api.github.com/repos/prateekmadhikar/temp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prateekmadhikar/temp/downloads","issues_url":"https://api.github.com/repos/prateekmadhikar/temp/issues{/number}","pulls_url":"https://api.github.com/repos/prateekmadhikar/temp/pulls{/number}","milestones_url":"https://api.github.com/repos/prateekmadhikar/temp/milestones{/number}","notifications_url":"https://api.github.com/repos/prateekmadhikar/temp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prateekmadhikar/temp/labels{/name}","releases_url":"https://api.github.com/repos/prateekmadhikar/temp/releases{/id}","deployments_url":"https://api.github.com/repos/prateekmadhikar/temp/deployments","created_at":"2016-08-24T02:04:02Z","updated_at":"2016-08-24T02:04:02Z","pushed_at":"2016-08-24T02:07:29Z","git_url":"git://github.com/prateekmadhikar/temp.git","ssh_url":"git@github.com:prateekmadhikar/temp.git","clone_url":"https://github.com/prateekmadhikar/temp.git","svn_url":"https://github.com/prateekmadhikar/temp","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"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"}},"_links":{"self":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1"},"html":{"href":"https://github.com/prateekmadhikar/temp/pull/1"},"issue":{"href":"https://api.github.com/repos/prateekmadhikar/temp/issues/1"},"comments":{"href":"https://api.github.com/repos/prateekmadhikar/temp/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prateekmadhikar/temp/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/prateekmadhikar/temp/statuses/4f30921b4e478caa77eac8df2dc60e8688ccffa2"}}}}
{"actor":{"display_login":"prateekmadhikar"}}