{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments/54202565","id":54202565,"diff_hunk":"@@ -0,0 +1,116 @@\n+'use strict';\n+const request = require('request');\n+var RussianStemmer = require('snowball-stemmer.jsx/dest/russian-stemmer.common.js').RussianStemmer;\n+\n+var key = require('fs').readFileSync('key.txt', 'utf-8');\n+\n+var urls = [];\n+var jsPattern = 'https://api.github.com/repos/urfu-2015/javascript-tasks-';\n+var htmlPattern = 'https://api.github.com/repos/urfu-2015/verstka-tasks-';\n+for (var i = 1; i <= 10; i++) {\n+    var str = i + '/readme?access_token=' + key;\n+    urls.push(jsPattern + str);\n+    urls.push(htmlPattern + str);\n+}\n+\n+var findTop = function (data) {\n+    var words = [];\n+    data.forEach(function (str) {\n+        var result = str.match(/[а-яa-z]+/ig);\n+        if (result !== null) {\n+            for (var i = 0; i < result.length; i++) {\n+                if (words.indexOf(result[i]) < 0) words.push(result[i]);\n+            }\n+        }\n+    });\n+    var stemmer = new RussianStemmer;\n+    var result = [];\n+    for (var i = 0; i < words.length; i++) {\n+        var stem = stemmer.stemWord(words[i]);\n+        var exists = false;\n+        for (var j = 0; j < result.length; j++) {\n+            if (result[j][0] === stem) {\n+                result[j][1] += 1;\n+                exists = true;\n+                break;\n+            }\n+        }\n+        if (!exists) result.push([stem, 1, words[i]]);\n+    }\n+    result.sort(function (a, b) {\n+        return b[1] - a[1];\n+    });\n+    return result;\n+};\n+\n+var printTop = function (data, n) {\n+    if (n >= data.length) n = data.length -1;\n+    for (var i = 0; i < n; i++) {\n+        console.log(data[i][2], data[i][1]);\n+    }\n+};\n+\n+var printCount = function (data, word) {\n+    var stemmer = new RussianStemmer;\n+    var stem = stemmer.stemWord(word);\n+    for (var i = 0; i < data.length; i++) {\n+        if (data[i][0] === stem) {\n+            console.log(data[i][1]);\n+            break;\n+        }\n+    }\n+};\n+\n+var generate = function(method, attr) {\n+    var res = [];\n+\n+    var req = new Promise(function(resolve, reject) {\n+        urls.forEach(function (uri, i) {\n+            var options = {\n+                url: uri,\n+                headers: {\n+                    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'\n+                }\n+            };\n+            request(options, function (error, response, body) {\n+                if (!error && response.statusCode === 200) {\n+                    //console.log('connected');\n+                    const registry = JSON.parse(body);\n+                    res.push(new Buffer(registry.content, 'base64').toString('utf-8'));\n+                } else {\n+                    //console.log('Can not connect');\n+                    res.push('');\n+                }\n+                if (res.length === urls.length) {\n+                    resolve(res);","path":"counter.js","position":85,"original_position":85,"commit_id":"9dab8d064b979c10d5a442485507c7ef9cec9be4","original_commit_id":"9dab8d064b979c10d5a442485507c7ef9cec9be4","user":{"login":"dzlk","id":894822,"avatar_url":"https://avatars.githubusercontent.com/u/894822?v=3","gravatar_id":"","url":"https://api.github.com/users/dzlk","html_url":"https://github.com/dzlk","followers_url":"https://api.github.com/users/dzlk/followers","following_url":"https://api.github.com/users/dzlk/following{/other_user}","gists_url":"https://api.github.com/users/dzlk/gists{/gist_id}","starred_url":"https://api.github.com/users/dzlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzlk/subscriptions","organizations_url":"https://api.github.com/users/dzlk/orgs","repos_url":"https://api.github.com/users/dzlk/repos","events_url":"https://api.github.com/users/dzlk/events{/privacy}","received_events_url":"https://api.github.com/users/dzlk/received_events","type":"User","site_admin":false},"body":":book: \r\nhttps://learn.javascript.ru/promise\r\nhttps://learn.javascript.ru/promise#параллельное-выполнение","created_at":"2016-02-26T03:53:46Z","updated_at":"2016-02-26T03:53:46Z","html_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/14#discussion_r54202565","pull_request_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments/54202565"},"html":{"href":"https://github.com/urfu-2015/webdev-tasks-1/pull/14#discussion_r54202565"},"pull_request":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14","id":60550353,"html_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/14","diff_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/14.diff","patch_url":"https://github.com/urfu-2015/webdev-tasks-1/pull/14.patch","issue_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/14","number":14,"state":"open","locked":false,"title":"Пестов Никита","user":{"login":"Nikit0s","id":6998975,"avatar_url":"https://avatars.githubusercontent.com/u/6998975?v=3","gravatar_id":"","url":"https://api.github.com/users/Nikit0s","html_url":"https://github.com/Nikit0s","followers_url":"https://api.github.com/users/Nikit0s/followers","following_url":"https://api.github.com/users/Nikit0s/following{/other_user}","gists_url":"https://api.github.com/users/Nikit0s/gists{/gist_id}","starred_url":"https://api.github.com/users/Nikit0s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nikit0s/subscriptions","organizations_url":"https://api.github.com/users/Nikit0s/orgs","repos_url":"https://api.github.com/users/Nikit0s/repos","events_url":"https://api.github.com/users/Nikit0s/events{/privacy}","received_events_url":"https://api.github.com/users/Nikit0s/received_events","type":"User","site_admin":false},"body":"Не могу понять почему, но постоянно выкачиваются не все тексты задач. Иногда все, иногда 3, 5 и т.п. Нужна помощь)) Время выполнения примерно секунд 15.","created_at":"2016-02-24T17:54:51Z","updated_at":"2016-02-26T03:53:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"823b04c574cc356eaf45494da0c34436cdc33cfe","assignee":{"login":"dzlk","id":894822,"avatar_url":"https://avatars.githubusercontent.com/u/894822?v=3","gravatar_id":"","url":"https://api.github.com/users/dzlk","html_url":"https://github.com/dzlk","followers_url":"https://api.github.com/users/dzlk/followers","following_url":"https://api.github.com/users/dzlk/following{/other_user}","gists_url":"https://api.github.com/users/dzlk/gists{/gist_id}","starred_url":"https://api.github.com/users/dzlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dzlk/subscriptions","organizations_url":"https://api.github.com/users/dzlk/orgs","repos_url":"https://api.github.com/users/dzlk/repos","events_url":"https://api.github.com/users/dzlk/events{/privacy}","received_events_url":"https://api.github.com/users/dzlk/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14/commits","review_comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14/comments","review_comment_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/14/comments","statuses_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/9dab8d064b979c10d5a442485507c7ef9cec9be4","head":{"label":"Nikit0s:master","ref":"master","sha":"9dab8d064b979c10d5a442485507c7ef9cec9be4","user":{"login":"Nikit0s","id":6998975,"avatar_url":"https://avatars.githubusercontent.com/u/6998975?v=3","gravatar_id":"","url":"https://api.github.com/users/Nikit0s","html_url":"https://github.com/Nikit0s","followers_url":"https://api.github.com/users/Nikit0s/followers","following_url":"https://api.github.com/users/Nikit0s/following{/other_user}","gists_url":"https://api.github.com/users/Nikit0s/gists{/gist_id}","starred_url":"https://api.github.com/users/Nikit0s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nikit0s/subscriptions","organizations_url":"https://api.github.com/users/Nikit0s/orgs","repos_url":"https://api.github.com/users/Nikit0s/repos","events_url":"https://api.github.com/users/Nikit0s/events{/privacy}","received_events_url":"https://api.github.com/users/Nikit0s/received_events","type":"User","site_admin":false},"repo":{"id":52162684,"name":"webdev-tasks-1","full_name":"Nikit0s/webdev-tasks-1","owner":{"login":"Nikit0s","id":6998975,"avatar_url":"https://avatars.githubusercontent.com/u/6998975?v=3","gravatar_id":"","url":"https://api.github.com/users/Nikit0s","html_url":"https://github.com/Nikit0s","followers_url":"https://api.github.com/users/Nikit0s/followers","following_url":"https://api.github.com/users/Nikit0s/following{/other_user}","gists_url":"https://api.github.com/users/Nikit0s/gists{/gist_id}","starred_url":"https://api.github.com/users/Nikit0s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nikit0s/subscriptions","organizations_url":"https://api.github.com/users/Nikit0s/orgs","repos_url":"https://api.github.com/users/Nikit0s/repos","events_url":"https://api.github.com/users/Nikit0s/events{/privacy}","received_events_url":"https://api.github.com/users/Nikit0s/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nikit0s/webdev-tasks-1","description":"","fork":true,"url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1","forks_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/forks","keys_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/teams","hooks_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/hooks","issue_events_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/issues/events{/number}","events_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/events","assignees_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/assignees{/user}","branches_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/branches{/branch}","tags_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/tags","blobs_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/statuses/{sha}","languages_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/languages","stargazers_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/stargazers","contributors_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/contributors","subscribers_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/subscribers","subscription_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/subscription","commits_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/contents/{+path}","compare_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/merges","archive_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/downloads","issues_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/issues{/number}","pulls_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/pulls{/number}","milestones_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/milestones{/number}","notifications_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/labels{/name}","releases_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/releases{/id}","deployments_url":"https://api.github.com/repos/Nikit0s/webdev-tasks-1/deployments","created_at":"2016-02-20T16:23:08Z","updated_at":"2016-02-24T17:51:53Z","pushed_at":"2016-02-25T05:37:51Z","git_url":"git://github.com/Nikit0s/webdev-tasks-1.git","ssh_url":"git@github.com:Nikit0s/webdev-tasks-1.git","clone_url":"https://github.com/Nikit0s/webdev-tasks-1.git","svn_url":"https://github.com/Nikit0s/webdev-tasks-1","homepage":null,"size":6,"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":"urfu-2015:master","ref":"master","sha":"6ff732253132f88e1eec631e611136f3676768b7","user":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":52003967,"name":"webdev-tasks-1","full_name":"urfu-2015/webdev-tasks-1","owner":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2015/webdev-tasks-1","description":"","fork":false,"url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1","forks_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/forks","keys_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/teams","hooks_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/hooks","issue_events_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/events","assignees_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/tags","blobs_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/languages","stargazers_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/stargazers","contributors_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/contributors","subscribers_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/subscribers","subscription_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/subscription","commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/merges","archive_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/downloads","issues_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/deployments","created_at":"2016-02-18T11:54:14Z","updated_at":"2016-02-18T11:54:14Z","pushed_at":"2016-02-25T22:06:05Z","git_url":"git://github.com/urfu-2015/webdev-tasks-1.git","ssh_url":"git@github.com:urfu-2015/webdev-tasks-1.git","clone_url":"https://github.com/urfu-2015/webdev-tasks-1.git","svn_url":"https://github.com/urfu-2015/webdev-tasks-1","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":23,"forks":35,"open_issues":23,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14"},"html":{"href":"https://github.com/urfu-2015/webdev-tasks-1/pull/14"},"issue":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/14"},"comments":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2015/webdev-tasks-1/statuses/9dab8d064b979c10d5a442485507c7ef9cec9be4"}}}}