Skip to content

Instantly share code, notes, and snippets.

@caseywatts
Last active May 1, 2019 14:02
Show Gist options
  • Select an option

  • Save caseywatts/f9be22834ad05e43ea8d3a0717849deb to your computer and use it in GitHub Desktop.

Select an option

Save caseywatts/f9be22834ad05e43ea8d3a0717849deb to your computer and use it in GitHub Desktop.

Revisions

  1. caseywatts revised this gist Sep 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0.md
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ This helps flip between a page the development server and the same page on the p
    # Installation
    - create a new bookmark in your browser
    - name: "flip"
    - url: copy-paste some code from below
    - url: paste something like the code below
  2. caseywatts revised this gist Sep 20, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions 0.md
    Original file line number Diff line number Diff line change
    @@ -5,3 +5,8 @@ Other gists & tricks: http://caseywatts.com/gists-and-tricks
    # Flipit

    This helps flip between a page the development server and the same page on the production server. Useful for comparing css or functionality changes quickly.

    # Installation
    - create a new bookmark in your browser
    - name: "flip"
    - url: copy-paste some code from below
  3. caseywatts revised this gist Sep 20, 2018. 2 changed files with 12 additions and 9 deletions.
    6 changes: 3 additions & 3 deletions single-site-flip.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    javascript:(function() {
    var host = window.location.hostname;
    var path = window.location.pathname;
    var port = window.location.port;
    var search = window.location.search;
    if (host !== "dashboard.heroku.com") {
    window.open("https://dashboard.heroku.com" + path)
    window.open("https://dashboard.heroku.com" + path + search)
    } else {
    window.open("http://localhost:4200" + path)
    window.open("http://localhost:4200" + path + search)
    }
    })();
    15 changes: 9 additions & 6 deletions two-sites-flip.js
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,22 @@
    javascript:(function() {
    javascript: (function() {
    var host = window.location.hostname;
    var path = window.location.pathname;
    var port = window.location.port;
    var onDashboard = (host === "dashboard.heroku.com" || (host === "localhost" && port === "4200"));
    var search = window.location.search;
    var onDashboard =
    host === "dashboard.heroku.com" ||
    (host === "localhost" && port === "4200");
    if (onDashboard) {
    if (host !== "dashboard.heroku.com") {
    window.open("https://dashboard.heroku.com" + path)
    window.open("https://dashboard.heroku.com" + path + search);
    } else {
    window.open("http://localhost:4200" + path)
    window.open("http://localhost:4200" + path + search);
    }
    } else {
    if (host !== "elements.heroku.com") {
    window.open("https://elements.heroku.com" + path)
    window.open("https://elements.heroku.com" + path + search);
    } else {
    window.open("http://localhost:5000" + path)
    window.open("http://localhost:5000" + path + search);
    }
    }
    })();
  4. caseywatts revised this gist Jun 10, 2017. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions 0.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    This helps flip between a page the development server and the same page on the production server.

    Link to this page: http://caseywatts.com/flipit

    Other gists & tricks: http://caseywatts.com/gists-and-tricks
    Other gists & tricks: http://caseywatts.com/gists-and-tricks

    # Flipit

    This helps flip between a page the development server and the same page on the production server. Useful for comparing css or functionality changes quickly.
  5. caseywatts revised this gist Jun 10, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    This helps flip between a page the development server and the same page on the production server.

    Link to this page: http://caseywatts.com/flipit
    Link to this page: http://caseywatts.com/flipit

    Other gists & tricks: http://caseywatts.com/gists-and-tricks
  6. caseywatts revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    This helps flip between a page the development server and the same page on the production server.

    Link: http://caseywatts.com/flipit
    Link to this page: http://caseywatts.com/flipit
  7. caseywatts revised this gist Feb 12, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    This helps flip between a page the development server and the same page on the production server.
    This helps flip between a page the development server and the same page on the production server.

    Link: http://caseywatts.com/flipit
  8. caseywatts revised this gist Feb 12, 2017. 2 changed files with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions single-site-flip.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    javascript:(function() {
    var host = window.location.hostname;
    var path = window.location.pathname;
    var port = window.location.port;
    if (host !== "dashboard.heroku.com") {
    window.open("https://dashboard.heroku.com" + path)
    } else {
    window.open("http://localhost:4200" + path)
    }
    })();
    File renamed without changes.
  9. caseywatts revised this gist Feb 12, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 0.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    This helps flip between a page the development server and the same page on the production server.
  10. caseywatts created this gist Nov 10, 2016.
    19 changes: 19 additions & 0 deletions flip.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    javascript:(function() {
    var host = window.location.hostname;
    var path = window.location.pathname;
    var port = window.location.port;
    var onDashboard = (host === "dashboard.heroku.com" || (host === "localhost" && port === "4200"));
    if (onDashboard) {
    if (host !== "dashboard.heroku.com") {
    window.open("https://dashboard.heroku.com" + path)
    } else {
    window.open("http://localhost:4200" + path)
    }
    } else {
    if (host !== "elements.heroku.com") {
    window.open("https://elements.heroku.com" + path)
    } else {
    window.open("http://localhost:5000" + path)
    }
    }
    })();