{"action":"created","comment":{"url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/comments/28428595","id":28428595,"diff_hunk":"@@ -0,0 +1,210 @@\n+--- === hs.windowgram ===\n+---\n+--- region generation using ascii rows similar to tmuxomatic for window areas\n+\n+local windowgram = {}\n+\n+-- Returns a table with the relative cols and rows.\n+function parseWindowgram(wg)\n+  local gridw = nil\n+\n+  local grid = {}\n+\n+  -- Split into lines\n+  local lines = {}\n+  for line in string.gmatch(wg, \"[^\\r\\n]+\") do\n+    if #line > 0 then\n+      table.insert(lines, line)\n+    end\n+  end\n+  lines = cleanLines(lines)\n+\n+  for i, line in ipairs(lines) do\n+    if gridw then\n+      if gridw ~= line:len() then\n+        error('inconsistent grid width in windowgram')\n+      end\n+    else\n+      gridw=line:len()\n+    end\n+    for column = 1, #line do\n+      local char = line:sub(column, column)\n+      if not grid[char] then\n+        -- new window, create it with size 1x1\n+        grid[char] = { x = column , y = i}\n+      else\n+        -- expand it\n+        grid[char].w = column\n+        grid[char].h = i\n+      end\n+    end\n+  end\n+  return grid\n+\n+end\n+\n+function cleanLines(wg)\n+  local target = {}\n+  for i,l in ipairs(wg) do\n+    -- Remove comments and whitespace\n+    l = l:gsub('#.*','')\n+    l = l:gsub(\"%s+\",\"\")\n+    table.insert(target, l)\n+  end\n+  return target\n+end\n+\n+--- hs.windowgram.getRegionRatios(regions)\n+--- Function\n+--- Gets a table with the regions as percentages of the screen resolution\n+---\n+--- Parameters:\n+---  * regions - The regions table returned by windowgram.convertToRegions(wg)\n+---\n+--- Returns:\n+---  * Table with ratios. ex; { x=0, y=0.5, w=0.5, h=1 }\n+---\n+--- Notes:\n+--- * These are numbers between 0 and 1 and represent two points; the top left","path":"extensions/windowgram/init.lua","position":68,"original_position":68,"commit_id":"8bb71a96d8e917886d01fd44eaff64032ddd1686","original_commit_id":"8bb71a96d8e917886d01fd44eaff64032ddd1686","user":{"login":"cmsj","id":353427,"avatar_url":"https://avatars.githubusercontent.com/u/353427?v=3","gravatar_id":"","url":"https://api.github.com/users/cmsj","html_url":"https://github.com/cmsj","followers_url":"https://api.github.com/users/cmsj/followers","following_url":"https://api.github.com/users/cmsj/following{/other_user}","gists_url":"https://api.github.com/users/cmsj/gists{/gist_id}","starred_url":"https://api.github.com/users/cmsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmsj/subscriptions","organizations_url":"https://api.github.com/users/cmsj/orgs","repos_url":"https://api.github.com/users/cmsj/repos","events_url":"https://api.github.com/users/cmsj/events{/privacy}","received_events_url":"https://api.github.com/users/cmsj/received_events","type":"User","site_admin":false},"body":"Missing a space before the *","created_at":"2015-04-15T15:11:45Z","updated_at":"2015-04-15T15:11:45Z","html_url":"https://github.com/Hammerspoon/hammerspoon/pull/260#discussion_r28428595","pull_request_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260","_links":{"self":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/comments/28428595"},"html":{"href":"https://github.com/Hammerspoon/hammerspoon/pull/260#discussion_r28428595"},"pull_request":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260"}}},"pull_request":{"url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260","id":32638422,"html_url":"https://github.com/Hammerspoon/hammerspoon/pull/260","diff_url":"https://github.com/Hammerspoon/hammerspoon/pull/260.diff","patch_url":"https://github.com/Hammerspoon/hammerspoon/pull/260.patch","issue_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/260","number":260,"state":"open","locked":false,"title":"Mjomatic refactor into Windowgram","user":{"login":"JosephFerano","id":2642263,"avatar_url":"https://avatars.githubusercontent.com/u/2642263?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephFerano","html_url":"https://github.com/JosephFerano","followers_url":"https://api.github.com/users/JosephFerano/followers","following_url":"https://api.github.com/users/JosephFerano/following{/other_user}","gists_url":"https://api.github.com/users/JosephFerano/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephFerano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephFerano/subscriptions","organizations_url":"https://api.github.com/users/JosephFerano/orgs","repos_url":"https://api.github.com/users/JosephFerano/repos","events_url":"https://api.github.com/users/JosephFerano/events{/privacy}","received_events_url":"https://api.github.com/users/JosephFerano/received_events","type":"User","site_admin":false},"body":"Fixing bug with mjomatic where it would only resize the main window of an app instead of all. Added vim swp and suo files to gitignore.","created_at":"2015-04-04T19:35:37Z","updated_at":"2015-04-15T15:11:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f5443c878c162bc0136c3e8bf507c685197ac86","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260/commits","review_comments_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260/comments","review_comment_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/260/comments","statuses_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/statuses/8bb71a96d8e917886d01fd44eaff64032ddd1686","head":{"label":"JosephFerano:master","ref":"master","sha":"8bb71a96d8e917886d01fd44eaff64032ddd1686","user":{"login":"JosephFerano","id":2642263,"avatar_url":"https://avatars.githubusercontent.com/u/2642263?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephFerano","html_url":"https://github.com/JosephFerano","followers_url":"https://api.github.com/users/JosephFerano/followers","following_url":"https://api.github.com/users/JosephFerano/following{/other_user}","gists_url":"https://api.github.com/users/JosephFerano/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephFerano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephFerano/subscriptions","organizations_url":"https://api.github.com/users/JosephFerano/orgs","repos_url":"https://api.github.com/users/JosephFerano/repos","events_url":"https://api.github.com/users/JosephFerano/events{/privacy}","received_events_url":"https://api.github.com/users/JosephFerano/received_events","type":"User","site_admin":false},"repo":{"id":33318093,"name":"hammerspoon","full_name":"JosephFerano/hammerspoon","owner":{"login":"JosephFerano","id":2642263,"avatar_url":"https://avatars.githubusercontent.com/u/2642263?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephFerano","html_url":"https://github.com/JosephFerano","followers_url":"https://api.github.com/users/JosephFerano/followers","following_url":"https://api.github.com/users/JosephFerano/following{/other_user}","gists_url":"https://api.github.com/users/JosephFerano/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephFerano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephFerano/subscriptions","organizations_url":"https://api.github.com/users/JosephFerano/orgs","repos_url":"https://api.github.com/users/JosephFerano/repos","events_url":"https://api.github.com/users/JosephFerano/events{/privacy}","received_events_url":"https://api.github.com/users/JosephFerano/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JosephFerano/hammerspoon","description":"Staggeringly powerful OS X desktop automation with Lua","fork":true,"url":"https://api.github.com/repos/JosephFerano/hammerspoon","forks_url":"https://api.github.com/repos/JosephFerano/hammerspoon/forks","keys_url":"https://api.github.com/repos/JosephFerano/hammerspoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JosephFerano/hammerspoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JosephFerano/hammerspoon/teams","hooks_url":"https://api.github.com/repos/JosephFerano/hammerspoon/hooks","issue_events_url":"https://api.github.com/repos/JosephFerano/hammerspoon/issues/events{/number}","events_url":"https://api.github.com/repos/JosephFerano/hammerspoon/events","assignees_url":"https://api.github.com/repos/JosephFerano/hammerspoon/assignees{/user}","branches_url":"https://api.github.com/repos/JosephFerano/hammerspoon/branches{/branch}","tags_url":"https://api.github.com/repos/JosephFerano/hammerspoon/tags","blobs_url":"https://api.github.com/repos/JosephFerano/hammerspoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JosephFerano/hammerspoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JosephFerano/hammerspoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/JosephFerano/hammerspoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JosephFerano/hammerspoon/statuses/{sha}","languages_url":"https://api.github.com/repos/JosephFerano/hammerspoon/languages","stargazers_url":"https://api.github.com/repos/JosephFerano/hammerspoon/stargazers","contributors_url":"https://api.github.com/repos/JosephFerano/hammerspoon/contributors","subscribers_url":"https://api.github.com/repos/JosephFerano/hammerspoon/subscribers","subscription_url":"https://api.github.com/repos/JosephFerano/hammerspoon/subscription","commits_url":"https://api.github.com/repos/JosephFerano/hammerspoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/JosephFerano/hammerspoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/JosephFerano/hammerspoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/JosephFerano/hammerspoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/JosephFerano/hammerspoon/contents/{+path}","compare_url":"https://api.github.com/repos/JosephFerano/hammerspoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JosephFerano/hammerspoon/merges","archive_url":"https://api.github.com/repos/JosephFerano/hammerspoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JosephFerano/hammerspoon/downloads","issues_url":"https://api.github.com/repos/JosephFerano/hammerspoon/issues{/number}","pulls_url":"https://api.github.com/repos/JosephFerano/hammerspoon/pulls{/number}","milestones_url":"https://api.github.com/repos/JosephFerano/hammerspoon/milestones{/number}","notifications_url":"https://api.github.com/repos/JosephFerano/hammerspoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JosephFerano/hammerspoon/labels{/name}","releases_url":"https://api.github.com/repos/JosephFerano/hammerspoon/releases{/id}","created_at":"2015-04-02T15:58:08Z","updated_at":"2015-04-09T05:36:21Z","pushed_at":"2015-04-15T06:18:16Z","git_url":"git://github.com/JosephFerano/hammerspoon.git","ssh_url":"git@github.com:JosephFerano/hammerspoon.git","clone_url":"https://github.com/JosephFerano/hammerspoon.git","svn_url":"https://github.com/JosephFerano/hammerspoon","homepage":"http://www.hammerspoon.org","size":12548,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","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":"Hammerspoon:master","ref":"master","sha":"5da2afb2985e3531601c195ac0ae66e385fbe8af","user":{"login":"Hammerspoon","id":9214848,"avatar_url":"https://avatars.githubusercontent.com/u/9214848?v=3","gravatar_id":"","url":"https://api.github.com/users/Hammerspoon","html_url":"https://github.com/Hammerspoon","followers_url":"https://api.github.com/users/Hammerspoon/followers","following_url":"https://api.github.com/users/Hammerspoon/following{/other_user}","gists_url":"https://api.github.com/users/Hammerspoon/gists{/gist_id}","starred_url":"https://api.github.com/users/Hammerspoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hammerspoon/subscriptions","organizations_url":"https://api.github.com/users/Hammerspoon/orgs","repos_url":"https://api.github.com/users/Hammerspoon/repos","events_url":"https://api.github.com/users/Hammerspoon/events{/privacy}","received_events_url":"https://api.github.com/users/Hammerspoon/received_events","type":"Organization","site_admin":false},"repo":{"id":24956772,"name":"hammerspoon","full_name":"Hammerspoon/hammerspoon","owner":{"login":"Hammerspoon","id":9214848,"avatar_url":"https://avatars.githubusercontent.com/u/9214848?v=3","gravatar_id":"","url":"https://api.github.com/users/Hammerspoon","html_url":"https://github.com/Hammerspoon","followers_url":"https://api.github.com/users/Hammerspoon/followers","following_url":"https://api.github.com/users/Hammerspoon/following{/other_user}","gists_url":"https://api.github.com/users/Hammerspoon/gists{/gist_id}","starred_url":"https://api.github.com/users/Hammerspoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hammerspoon/subscriptions","organizations_url":"https://api.github.com/users/Hammerspoon/orgs","repos_url":"https://api.github.com/users/Hammerspoon/repos","events_url":"https://api.github.com/users/Hammerspoon/events{/privacy}","received_events_url":"https://api.github.com/users/Hammerspoon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Hammerspoon/hammerspoon","description":"Staggeringly powerful OS X desktop automation with Lua","fork":false,"url":"https://api.github.com/repos/Hammerspoon/hammerspoon","forks_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/forks","keys_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/teams","hooks_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/hooks","issue_events_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/events{/number}","events_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/events","assignees_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/assignees{/user}","branches_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/branches{/branch}","tags_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/tags","blobs_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/statuses/{sha}","languages_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/languages","stargazers_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/stargazers","contributors_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/contributors","subscribers_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/subscribers","subscription_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/subscription","commits_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/contents/{+path}","compare_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/merges","archive_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/downloads","issues_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues{/number}","pulls_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls{/number}","milestones_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/milestones{/number}","notifications_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/labels{/name}","releases_url":"https://api.github.com/repos/Hammerspoon/hammerspoon/releases{/id}","created_at":"2014-10-08T19:24:44Z","updated_at":"2015-04-15T14:48:08Z","pushed_at":"2015-04-15T14:48:08Z","git_url":"git://github.com/Hammerspoon/hammerspoon.git","ssh_url":"git@github.com:Hammerspoon/hammerspoon.git","clone_url":"https://github.com/Hammerspoon/hammerspoon.git","svn_url":"https://github.com/Hammerspoon/hammerspoon","homepage":"http://www.hammerspoon.org","size":15124,"stargazers_count":194,"watchers_count":194,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":56,"forks":23,"open_issues":56,"watchers":194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260"},"html":{"href":"https://github.com/Hammerspoon/hammerspoon/pull/260"},"issue":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/260"},"comments":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/issues/260/comments"},"review_comments":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260/comments"},"review_comment":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/pulls/260/commits"},"statuses":{"href":"https://api.github.com/repos/Hammerspoon/hammerspoon/statuses/8bb71a96d8e917886d01fd44eaff64032ddd1686"}}}}