GitHub PullRequestReviewCommentEvent at 2014-06-20 20:53:02
Repository: guides
Actor: Keithbsmiley
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/guides/pulls/comments/14040721","id":14040721,"diff_hunk":"@@ -0,0 +1,67 @@\n+\n+import Foundation // or not\n+\n+// Closures -----------------------------------------------------------\n+\n+// Use typealias when closures are referenced in multiple places\n+typealias CoolClosure = (foo: Int) -> Bool\n+\n+// Use aliased parameter names when function parameters are ambiguous\n+func yTown(some: Int, withCallback callback: CoolClosure) -> Bool {\n+    return CoolClosure(some)\n+}\n+\n+// Use trailing closures\n+let cool = yTown(5) { (foo: Int) in\n+// or Don't cast parameters\n+let cool = yTown(5) { foo in\n+    return foo == 6\n+}\n+\n+// Don't use $ variable references\n+let cool = yTown(5) { $0 == 6 }\n+// But shortening to one line with small closures is OK\n+let cool = yTown(5) { foo in foo == 6 }\n+\n+// Optionals -----------------------------------------------------------\n+\n+var maybe: Bool?\n+\n+// Use if-let syntax to unwrap optionals\n+if let definitely = maybe {\n+    println(\"This is \\(definitely) here\")\n+}\n+\n+// If the API you are using has implicit unwrapping you don't need if-let\n+// But still check for its existance\n+func privateAPI(callback: (error: NSError!) -> ()) {\n+    callback(.None)\n+}\n+\n+privateAPI() { error in\n+    if error {\n+        println(\"Error: \\(error)\")\n+    }\n+}\n+\n+// Enums --------------------------------------------------------------\n+\n+enum Employee {\n+    case FullTime(name: String, office: String)\n+    case Apprentice(name: String, office: String, mentor: Employee)\n+}\n+\n+// when the type is known you can let the compiler infer\n+let tony = Employee.FullTime(name: \"Tony\", office: \"Boston\")\n+let gordon: Employee = .Apprentice(name: \"Gordon\", office: \"Boston\", mentor: tony)\n+\n+for emp in [tony, gordon] {\n+    switch emp {\n+    case .FullTime(let name, let office):\n+        println(\"\\(name) is a full time employee in \\(office)\")\n+    ","path":"style/samples/Swift.swift","position":62,"original_position":62,"commit_id":"44e98fdec7d51827aabceac066ade8b1b61f1f22","original_commit_id":"44e98fdec7d51827aabceac066ade8b1b61f1f22","user":{"login":"Keithbsmiley","id":283886,"avatar_url":"https://avatars.githubusercontent.com/u/283886?","gravatar_id":"6ab7ae85b84ebb323fab427b11500742","url":"https://api.github.com/users/Keithbsmiley","html_url":"https://github.com/Keithbsmiley","followers_url":"https://api.github.com/users/Keithbsmiley/followers","following_url":"https://api.github.com/users/Keithbsmiley/following{/other_user}","gists_url":"https://api.github.com/users/Keithbsmiley/gists{/gist_id}","starred_url":"https://api.github.com/users/Keithbsmiley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keithbsmiley/subscriptions","organizations_url":"https://api.github.com/users/Keithbsmiley/orgs","repos_url":"https://api.github.com/users/Keithbsmiley/repos","events_url":"https://api.github.com/users/Keithbsmiley/events{/privacy}","received_events_url":"https://api.github.com/users/Keithbsmiley/received_events","type":"User","site_admin":false},"body":"Blank line between cases","created_at":"2014-06-20T20:53:02Z","updated_at":"2014-06-20T20:53:02Z","html_url":"https://github.com/thoughtbot/guides/pull/198#discussion_r14040721","pull_request_url":"https://api.github.com/repos/thoughtbot/guides/pulls/198","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/comments/14040721"},"html":{"href":"https://github.com/thoughtbot/guides/pull/198#discussion_r14040721"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/198"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/guides/pulls/198","id":17426920,"html_url":"https://github.com/thoughtbot/guides/pull/198","diff_url":"https://github.com/thoughtbot/guides/pull/198.diff","patch_url":"https://github.com/thoughtbot/guides/pull/198.patch","issue_url":"https://api.github.com/repos/thoughtbot/guides/issues/198","number":198,"state":"open","title":"Add first pass at Swift style guide","user":{"login":"tonyd256","id":1169797,"avatar_url":"https://avatars.githubusercontent.com/u/1169797?","gravatar_id":"edbc2c30266f4c42a8912ea7d10e7bb3","url":"https://api.github.com/users/tonyd256","html_url":"https://github.com/tonyd256","followers_url":"https://api.github.com/users/tonyd256/followers","following_url":"https://api.github.com/users/tonyd256/following{/other_user}","gists_url":"https://api.github.com/users/tonyd256/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyd256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyd256/subscriptions","organizations_url":"https://api.github.com/users/tonyd256/orgs","repos_url":"https://api.github.com/users/tonyd256/repos","events_url":"https://api.github.com/users/tonyd256/events{/privacy}","received_events_url":"https://api.github.com/users/tonyd256/received_events","type":"User","site_admin":false},"body":null,"created_at":"2014-06-20T20:47:10Z","updated_at":"2014-06-20T20:53:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8350d5a5d073b31965bf4188b6a5f0b82f52f3e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/guides/pulls/198/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/guides/pulls/198/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/guides/pulls/comments/{number}","comments_url":"https://api.github.com/repos/thoughtbot/guides/issues/198/comments","statuses_url":"https://api.github.com/repos/thoughtbot/guides/statuses/44e98fdec7d51827aabceac066ade8b1b61f1f22","head":{"label":"thoughtbot:td-swift-closures","ref":"td-swift-closures","sha":"44e98fdec7d51827aabceac066ade8b1b61f1f22","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?","gravatar_id":"a95a04df2dae60397c38c9bd04492c53","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":5200099,"name":"guides","full_name":"thoughtbot/guides","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?","gravatar_id":"a95a04df2dae60397c38c9bd04492c53","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/guides","description":"A guide for programming in style.","fork":false,"url":"https://api.github.com/repos/thoughtbot/guides","forks_url":"https://api.github.com/repos/thoughtbot/guides/forks","keys_url":"https://api.github.com/repos/thoughtbot/guides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/guides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/guides/teams","hooks_url":"https://api.github.com/repos/thoughtbot/guides/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/guides/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/guides/events","assignees_url":"https://api.github.com/repos/thoughtbot/guides/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/guides/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/guides/tags","blobs_url":"https://api.github.com/repos/thoughtbot/guides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/guides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/guides/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/guides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/guides/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/guides/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/guides/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/guides/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/guides/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/guides/subscription","commits_url":"https://api.github.com/repos/thoughtbot/guides/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/guides/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/guides/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/guides/issues/comments/{number}","contents_url":"https://api.github.com/repos/thoughtbot/guides/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/guides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/guides/merges","archive_url":"https://api.github.com/repos/thoughtbot/guides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/guides/downloads","issues_url":"https://api.github.com/repos/thoughtbot/guides/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/guides/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/guides/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/guides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/guides/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/guides/releases{/id}","created_at":"2012-07-27T03:15:44Z","updated_at":"2014-06-20T20:47:10Z","pushed_at":"2014-06-20T20:46:57Z","git_url":"git://github.com/thoughtbot/guides.git","ssh_url":"git@github.com:thoughtbot/guides.git","clone_url":"https://github.com/thoughtbot/guides.git","svn_url":"https://github.com/thoughtbot/guides","homepage":"","size":4288,"stargazers_count":2449,"watchers_count":2449,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":372,"mirror_url":null,"open_issues_count":23,"forks":372,"open_issues":23,"watchers":2449,"default_branch":"master"}},"base":{"label":"thoughtbot:master","ref":"master","sha":"7f94caad21cf485b380864afefdfa987887cdc8e","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?","gravatar_id":"a95a04df2dae60397c38c9bd04492c53","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":5200099,"name":"guides","full_name":"thoughtbot/guides","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?","gravatar_id":"a95a04df2dae60397c38c9bd04492c53","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/guides","description":"A guide for programming in style.","fork":false,"url":"https://api.github.com/repos/thoughtbot/guides","forks_url":"https://api.github.com/repos/thoughtbot/guides/forks","keys_url":"https://api.github.com/repos/thoughtbot/guides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/guides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/guides/teams","hooks_url":"https://api.github.com/repos/thoughtbot/guides/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/guides/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/guides/events","assignees_url":"https://api.github.com/repos/thoughtbot/guides/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/guides/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/guides/tags","blobs_url":"https://api.github.com/repos/thoughtbot/guides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/guides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/guides/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/guides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/guides/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/guides/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/guides/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/guides/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/guides/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/guides/subscription","commits_url":"https://api.github.com/repos/thoughtbot/guides/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/guides/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/guides/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/guides/issues/comments/{number}","contents_url":"https://api.github.com/repos/thoughtbot/guides/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/guides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/guides/merges","archive_url":"https://api.github.com/repos/thoughtbot/guides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/guides/downloads","issues_url":"https://api.github.com/repos/thoughtbot/guides/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/guides/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/guides/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/guides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/guides/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/guides/releases{/id}","created_at":"2012-07-27T03:15:44Z","updated_at":"2014-06-20T20:47:10Z","pushed_at":"2014-06-20T20:46:57Z","git_url":"git://github.com/thoughtbot/guides.git","ssh_url":"git@github.com:thoughtbot/guides.git","clone_url":"https://github.com/thoughtbot/guides.git","svn_url":"https://github.com/thoughtbot/guides","homepage":"","size":4288,"stargazers_count":2449,"watchers_count":2449,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":372,"mirror_url":null,"open_issues_count":23,"forks":372,"open_issues":23,"watchers":2449,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/198"},"html":{"href":"https://github.com/thoughtbot/guides/pull/198"},"issue":{"href":"https://api.github.com/repos/thoughtbot/guides/issues/198"},"comments":{"href":"https://api.github.com/repos/thoughtbot/guides/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/198/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/guides/pulls/198/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/guides/statuses/44e98fdec7d51827aabceac066ade8b1b61f1f22"}}}}