{"action":"created","comment":{"url":"https://api.github.com/repos/steaks/codeducky/pulls/comments/26279186","id":26279186,"diff_hunk":"@@ -0,0 +1,243 @@\n+Hey AngularJS devs!  Let's talk about executing async tasks serially with promises.\n+\n+First, we notice .then allows our success/fail callbacks to return a promise.  $q treats success/fail callbacks that return promises specially.  We'll look at two examples to see how $q treats success/fail functions that return promises differently from those that don't.\n+<!--more-->\n+\n+Normal success function:\n+<pre>\n+$q.when()  \n+.then(function () { console.log(\"foo\"); })\n+.then(function () { console.log(\"bar\"); });\n+</pre>\n+<pre>\n+foo\n+bar\n+</pre>\n+<br/>\n+Success function that returns a promise:\n+<pre>\n+$q.when()\n+.then(function () { \n+  console.log(\"foo\"); \n+  var bazDeferred = $q.defer();","path":"blogs/qserial.md","position":22,"original_position":22,"commit_id":"9fe03cdc1a2c1c8ab9e73bb3efb6853064e85dd6","original_commit_id":"9fe03cdc1a2c1c8ab9e73bb3efb6853064e85dd6","user":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"body":"bazDeferred is a \"Deferred\".  I really dislike the name.  I'd prefer it to just be called task (eventhough it's not really a task).  I think the following reads much more clearly:\r\n```\r\nvar bazTask = $q.task();\r\ndoStuff()\r\nbazTask.complete();\r\n\r\nvar bazTask = $q.defer();\r\ndoStuff();\r\nbazTask.resolve();\r\n```","created_at":"2015-03-12T05:16:32Z","updated_at":"2015-03-12T05:16:32Z","html_url":"https://github.com/steaks/codeducky/pull/32#discussion_r26279186","pull_request_url":"https://api.github.com/repos/steaks/codeducky/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/comments/26279186"},"html":{"href":"https://github.com/steaks/codeducky/pull/32#discussion_r26279186"},"pull_request":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/steaks/codeducky/pulls/32","id":30730916,"html_url":"https://github.com/steaks/codeducky/pull/32","diff_url":"https://github.com/steaks/codeducky/pull/32.diff","patch_url":"https://github.com/steaks/codeducky/pull/32.patch","issue_url":"https://api.github.com/repos/steaks/codeducky/issues/32","number":32,"state":"open","locked":false,"title":"Added qserial","user":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"body":"http://www.codeducky.org/?p=699&preview=true","created_at":"2015-03-09T01:17:45Z","updated_at":"2015-03-12T05:16:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e53edbe27b4020f2ea4ce27ecb21809561aae3b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/steaks/codeducky/pulls/32/commits","review_comments_url":"https://api.github.com/repos/steaks/codeducky/pulls/32/comments","review_comment_url":"https://api.github.com/repos/steaks/codeducky/pulls/comments{/number}","comments_url":"https://api.github.com/repos/steaks/codeducky/issues/32/comments","statuses_url":"https://api.github.com/repos/steaks/codeducky/statuses/9fe03cdc1a2c1c8ab9e73bb3efb6853064e85dd6","head":{"label":"steaks:qserial","ref":"qserial","sha":"9fe03cdc1a2c1c8ab9e73bb3efb6853064e85dd6","user":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"repo":{"id":15691223,"name":"codeducky","full_name":"steaks/codeducky","owner":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steaks/codeducky","description":"This repository is used to iterate on and store blogs for http://www.codeducky.org/. Please email Steven Wexler at steven.m.wexler@gmail.com if you'd like to contribute to Code Ducky.","fork":false,"url":"https://api.github.com/repos/steaks/codeducky","forks_url":"https://api.github.com/repos/steaks/codeducky/forks","keys_url":"https://api.github.com/repos/steaks/codeducky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steaks/codeducky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steaks/codeducky/teams","hooks_url":"https://api.github.com/repos/steaks/codeducky/hooks","issue_events_url":"https://api.github.com/repos/steaks/codeducky/issues/events{/number}","events_url":"https://api.github.com/repos/steaks/codeducky/events","assignees_url":"https://api.github.com/repos/steaks/codeducky/assignees{/user}","branches_url":"https://api.github.com/repos/steaks/codeducky/branches{/branch}","tags_url":"https://api.github.com/repos/steaks/codeducky/tags","blobs_url":"https://api.github.com/repos/steaks/codeducky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steaks/codeducky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steaks/codeducky/git/refs{/sha}","trees_url":"https://api.github.com/repos/steaks/codeducky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steaks/codeducky/statuses/{sha}","languages_url":"https://api.github.com/repos/steaks/codeducky/languages","stargazers_url":"https://api.github.com/repos/steaks/codeducky/stargazers","contributors_url":"https://api.github.com/repos/steaks/codeducky/contributors","subscribers_url":"https://api.github.com/repos/steaks/codeducky/subscribers","subscription_url":"https://api.github.com/repos/steaks/codeducky/subscription","commits_url":"https://api.github.com/repos/steaks/codeducky/commits{/sha}","git_commits_url":"https://api.github.com/repos/steaks/codeducky/git/commits{/sha}","comments_url":"https://api.github.com/repos/steaks/codeducky/comments{/number}","issue_comment_url":"https://api.github.com/repos/steaks/codeducky/issues/comments{/number}","contents_url":"https://api.github.com/repos/steaks/codeducky/contents/{+path}","compare_url":"https://api.github.com/repos/steaks/codeducky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steaks/codeducky/merges","archive_url":"https://api.github.com/repos/steaks/codeducky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steaks/codeducky/downloads","issues_url":"https://api.github.com/repos/steaks/codeducky/issues{/number}","pulls_url":"https://api.github.com/repos/steaks/codeducky/pulls{/number}","milestones_url":"https://api.github.com/repos/steaks/codeducky/milestones{/number}","notifications_url":"https://api.github.com/repos/steaks/codeducky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steaks/codeducky/labels{/name}","releases_url":"https://api.github.com/repos/steaks/codeducky/releases{/id}","created_at":"2014-01-07T00:50:28Z","updated_at":"2015-01-06T15:51:01Z","pushed_at":"2015-03-09T02:37:14Z","git_url":"git://github.com/steaks/codeducky.git","ssh_url":"git@github.com:steaks/codeducky.git","clone_url":"https://github.com/steaks/codeducky.git","svn_url":"https://github.com/steaks/codeducky","homepage":"http://www.codeducky.org","size":1627,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"base":{"label":"steaks:master","ref":"master","sha":"88200a2539b68f2f83394a94f83d3e7830e36603","user":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"repo":{"id":15691223,"name":"codeducky","full_name":"steaks/codeducky","owner":{"login":"steaks","id":1373752,"avatar_url":"https://avatars.githubusercontent.com/u/1373752?v=3","gravatar_id":"","url":"https://api.github.com/users/steaks","html_url":"https://github.com/steaks","followers_url":"https://api.github.com/users/steaks/followers","following_url":"https://api.github.com/users/steaks/following{/other_user}","gists_url":"https://api.github.com/users/steaks/gists{/gist_id}","starred_url":"https://api.github.com/users/steaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steaks/subscriptions","organizations_url":"https://api.github.com/users/steaks/orgs","repos_url":"https://api.github.com/users/steaks/repos","events_url":"https://api.github.com/users/steaks/events{/privacy}","received_events_url":"https://api.github.com/users/steaks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steaks/codeducky","description":"This repository is used to iterate on and store blogs for http://www.codeducky.org/. Please email Steven Wexler at steven.m.wexler@gmail.com if you'd like to contribute to Code Ducky.","fork":false,"url":"https://api.github.com/repos/steaks/codeducky","forks_url":"https://api.github.com/repos/steaks/codeducky/forks","keys_url":"https://api.github.com/repos/steaks/codeducky/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steaks/codeducky/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steaks/codeducky/teams","hooks_url":"https://api.github.com/repos/steaks/codeducky/hooks","issue_events_url":"https://api.github.com/repos/steaks/codeducky/issues/events{/number}","events_url":"https://api.github.com/repos/steaks/codeducky/events","assignees_url":"https://api.github.com/repos/steaks/codeducky/assignees{/user}","branches_url":"https://api.github.com/repos/steaks/codeducky/branches{/branch}","tags_url":"https://api.github.com/repos/steaks/codeducky/tags","blobs_url":"https://api.github.com/repos/steaks/codeducky/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steaks/codeducky/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steaks/codeducky/git/refs{/sha}","trees_url":"https://api.github.com/repos/steaks/codeducky/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steaks/codeducky/statuses/{sha}","languages_url":"https://api.github.com/repos/steaks/codeducky/languages","stargazers_url":"https://api.github.com/repos/steaks/codeducky/stargazers","contributors_url":"https://api.github.com/repos/steaks/codeducky/contributors","subscribers_url":"https://api.github.com/repos/steaks/codeducky/subscribers","subscription_url":"https://api.github.com/repos/steaks/codeducky/subscription","commits_url":"https://api.github.com/repos/steaks/codeducky/commits{/sha}","git_commits_url":"https://api.github.com/repos/steaks/codeducky/git/commits{/sha}","comments_url":"https://api.github.com/repos/steaks/codeducky/comments{/number}","issue_comment_url":"https://api.github.com/repos/steaks/codeducky/issues/comments{/number}","contents_url":"https://api.github.com/repos/steaks/codeducky/contents/{+path}","compare_url":"https://api.github.com/repos/steaks/codeducky/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steaks/codeducky/merges","archive_url":"https://api.github.com/repos/steaks/codeducky/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steaks/codeducky/downloads","issues_url":"https://api.github.com/repos/steaks/codeducky/issues{/number}","pulls_url":"https://api.github.com/repos/steaks/codeducky/pulls{/number}","milestones_url":"https://api.github.com/repos/steaks/codeducky/milestones{/number}","notifications_url":"https://api.github.com/repos/steaks/codeducky/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steaks/codeducky/labels{/name}","releases_url":"https://api.github.com/repos/steaks/codeducky/releases{/id}","created_at":"2014-01-07T00:50:28Z","updated_at":"2015-01-06T15:51:01Z","pushed_at":"2015-03-09T02:37:14Z","git_url":"git://github.com/steaks/codeducky.git","ssh_url":"git@github.com:steaks/codeducky.git","clone_url":"https://github.com/steaks/codeducky.git","svn_url":"https://github.com/steaks/codeducky","homepage":"http://www.codeducky.org","size":1627,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/32"},"html":{"href":"https://github.com/steaks/codeducky/pull/32"},"issue":{"href":"https://api.github.com/repos/steaks/codeducky/issues/32"},"comments":{"href":"https://api.github.com/repos/steaks/codeducky/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/steaks/codeducky/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/steaks/codeducky/statuses/9fe03cdc1a2c1c8ab9e73bb3efb6853064e85dd6"}}}}