Skip to content

Instantly share code, notes, and snippets.

@UnquietCode
Last active January 22, 2019 23:32
Show Gist options
  • Select an option

  • Save UnquietCode/c8dba8a5e8f0bea43ac7aa75f0277142 to your computer and use it in GitHub Desktop.

Select an option

Save UnquietCode/c8dba8a5e8f0bea43ac7aa75f0277142 to your computer and use it in GitHub Desktop.

Revisions

  1. UnquietCode revised this gist Jan 22, 2019. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion 1-script.js
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,5 @@
    let nodes = document.querySelectorAll(".IssueLabel[title^=\"size\"]");
    nodes.forEach(reducer);

    console.log("total size is", sum);
    alert("total size is "+sum+" days ("+(sum*8)+" hours)");
    })();
    2 changes: 1 addition & 1 deletion 2-bookmarklet.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function()%7B(function()%20%7B%0A%20%20let%20sum%20%3D%200%3B%0A%0A%20%20let%20reducer%20%3D%20function(x)%20%7B%0A%20%20%20%20let%20size%20%3D%20x.title%3B%0A%20%20%20%20let%20split%20%3D%20size.indexOf(%27%3A%27)%20%2B%201%3B%0A%20%20%20%20size%20%3D%20size.substring(split).trim()%3B%0A%0A%20%20%20%20sum%20%2B%3D%20Number(size)%3B%0A%20%20%7D%3B%0A%0A%20%20let%20nodes%20%3D%20document.querySelectorAll(%22.IssueLabel%5Btitle%5E%3D%5C%22size%5C%22%5D%22)%3B%0A%20%20nodes.forEach(reducer)%3B%0A%0A%20%20alert(%22total%20size%20is%20%22%2Bsum)%3B%0A%7D)()%3B%7D)()
    javascript:(function()%7B(function()%20%7Blet%20sum%20%3D%200%3Blet%20reducer%20%3D%20function(x)%20%7Blet%20size%20%3D%20x.title%3Blet%20split%20%3D%20size.indexOf('%3A')%20%2B%201%3Bsize%20%3D%20size.substring(split).trim()%3Bsum%20%2B%3D%20Number(size)%3B%7D%3Blet%20nodes%20%3D%20document.querySelectorAll(%22.IssueLabel%5Btitle%5E%3D%5C%22size%5C%22%5D%22)%3Bnodes.forEach(reducer)%3Balert(%22total%20size%20is%20%22%2Bsum%2B%22%20days%20(%22%2B(sum*8)%2B%22%20hours)%22)%3B%7D)()%7D)()
  2. UnquietCode revised this gist Jul 9, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,14 @@
    1. copy the bookmarklet code below
    1. create a new bookmark with the code as the URL
    1. navigate to an issues listing view in GitHub, like a milestone view
    1. click the bookmark an an alert box will show you the results
    1. click the bookmark, an alert box will show you the results

    ## Script Usage
    1. navigate to an issues listing view in GitHub, like a milestone view
    1. copy the code snippet
    1. open the browsers JavaScript developer console on the page
    1. paste the code into the console and run it
    1. the console output contains the results

    ## Notes
    * the issues need a label like `size: 1` or `size : 1`
  3. UnquietCode revised this gist Jul 9, 2018. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,14 @@
    ## Bookmarklet Usage
    0. copy the bookmarklet code below
    0. create a new bookmark with the code as the URL
    0. navigate to an issues listing view in GitHub, like a milestone view
    0. click the bookmark an an alert box will show you the results
    1. copy the bookmarklet code below
    1. create a new bookmark with the code as the URL
    1. navigate to an issues listing view in GitHub, like a milestone view
    1. click the bookmark an an alert box will show you the results

    ## Script Usage
    0. navigate to an issues listing view in GitHub, like a milestone view
    0. copy the code snippet
    0. open the browsers JavaScript developer console on the page
    0. paste the code into the console and run it
    1. navigate to an issues listing view in GitHub, like a milestone view
    1. copy the code snippet
    1. open the browsers JavaScript developer console on the page
    1. paste the code into the console and run it

    ## Notes
    * the issues need a label like `size: 1` or `size : 1`
  4. UnquietCode revised this gist Jul 9, 2018. 2 changed files with 8 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,10 @@
    ## Usage
    ## Bookmarklet Usage
    0. copy the bookmarklet code below
    0. create a new bookmark with the code as the URL
    0. navigate to an issues listing view in GitHub, like a milestone view
    0. click the bookmark an an alert box will show you the results

    ## Script Usage
    0. navigate to an issues listing view in GitHub, like a milestone view
    0. copy the code snippet
    0. open the browsers JavaScript developer console on the page
    1 change: 1 addition & 0 deletions 2-bookmarklet.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    javascript:(function()%7B(function()%20%7B%0A%20%20let%20sum%20%3D%200%3B%0A%0A%20%20let%20reducer%20%3D%20function(x)%20%7B%0A%20%20%20%20let%20size%20%3D%20x.title%3B%0A%20%20%20%20let%20split%20%3D%20size.indexOf(%27%3A%27)%20%2B%201%3B%0A%20%20%20%20size%20%3D%20size.substring(split).trim()%3B%0A%0A%20%20%20%20sum%20%2B%3D%20Number(size)%3B%0A%20%20%7D%3B%0A%0A%20%20let%20nodes%20%3D%20document.querySelectorAll(%22.IssueLabel%5Btitle%5E%3D%5C%22size%5C%22%5D%22)%3B%0A%20%20nodes.forEach(reducer)%3B%0A%0A%20%20alert(%22total%20size%20is%20%22%2Bsum)%3B%0A%7D)()%3B%7D)()
  5. UnquietCode revised this gist Jul 9, 2018. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    ## Usage
    0. navigate to an issues listing view in GitHub, like a milestone view
    0. copy the code snippet
    0. open the browsers JavaScript developer console on the page
    0. paste the code into the console and run it

    ## Notes
    * the issues need a label like `size: 1` or `size : 1`
    * sums everything it sees on the page
    * executes in a closure so it can be re-run if needed
  6. UnquietCode revised this gist Jul 9, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    * the issues need a label like `size: 1` or `size : 1`
    * sums everything it sees on the page
    * executes in a closure so it can be rerun if needed
    * executes in a closure so it can be re-run if needed
    * will break if GitHub styles ever change significantly
    * looks for nodes with the `IssueLabel` class and `title` attribute
  7. UnquietCode revised this gist Jul 9, 2018. 2 changed files with 16 additions and 12 deletions.
    4 changes: 3 additions & 1 deletion 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    * the issues need a label like `size: 1` or `size : 1`
    * the issues need a label like `size: 1` or `size : 1`
    * sums everything it sees on the page
    * executes in a closure so it can be rerun if needed
    24 changes: 13 additions & 11 deletions 1-script.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,16 @@
    let sum = 0;
    (function() {
    let sum = 0;

    let reducer = function(x) {
    let size = x.title;
    let split = size.indexOf(':') + 1;
    size = size.substring(split).trim();

    sum += Number(size);
    };
    let reducer = function(x) {
    let size = x.title;
    let split = size.indexOf(':') + 1;
    size = size.substring(split).trim();

    let nodes = document.querySelectorAll(".IssueLabel[title^=\"size\"]");
    nodes.forEach(reducer);
    sum += Number(size);
    };

    console.log("total size is", sum);
    let nodes = document.querySelectorAll(".IssueLabel[title^=\"size\"]");
    nodes.forEach(reducer);

    console.log("total size is", sum);
    })();
  8. UnquietCode revised this gist Jul 9, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 1-script.js
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,6 @@ let reducer = function(x) {
    };

    let nodes = document.querySelectorAll(".IssueLabel[title^=\"size\"]");
    nodes.forEach(reducer);
    nodes.forEach(reducer);

    console.log("total size is", sum);
  9. UnquietCode created this gist Jul 9, 2018.
    1 change: 1 addition & 0 deletions 0-notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    * the issues need a label like `size: 1` or `size : 1`
    12 changes: 12 additions & 0 deletions 1-script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    let sum = 0;

    let reducer = function(x) {
    let size = x.title;
    let split = size.indexOf(':') + 1;
    size = size.substring(split).trim();

    sum += Number(size);
    };

    let nodes = document.querySelectorAll(".IssueLabel[title^=\"size\"]");
    nodes.forEach(reducer);