Thanks to visit codestin.com
Credit goes to github.com

Skip to content

adijha/productive-dev-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

bash functions


function gitpush() {
    git add .
    if [ "$1" != "" ]
    then
        git commit -m "$1"
    else
        print $fg_bold[red] "Oh! you missed to write commit message"
        return 0
    fi # closing statement of if-else block
    git push origin HEAD
}

function gitnew() {
    git checkout master
    git pull
    if [ "$1" != "" ]
    then
        git checkout -b "$1"
    else
        print $fg_bold[red] "Oh! you missed to write branch name"
        return 0
    fi # closing statement of if-else block
}



Auto Refresh on code change

you need to install these tools

brew install chrome-cli
sudo npm i -g nodemon 

permission

image

script

save this file as refresher.js in root directory

const { exec } = require('child_process');

const merchantDashboard = 'Razorpay Dashboard';
const adminDashboard = 'Razorpay - Admin Panel';

function reloadTab(tabId) {
  exec('chrome-cli reload -t ' + tabId, (error, stdout, stderr) => {
    if (error) {
      console.log(`error: ${error.message}`);
      return;
    }
    if (stderr) {
      console.log(`stderr: ${stderr}`);
      return;
    }
    if (stdout) {
      console.log(`stdout: ${stdout}`);
      return;
    }
  });
}
function refreshChromeTab(matchString) {
  exec('chrome-cli list tabs', (error, stdout, stderr) => {
    let tabId = '';
    if (error) {
      console.log(`error: ${error.message}`);
      return;
    }
    if (stderr) {
      console.log(`stderr: ${stderr}`);
      return;
    }
    let arrTab = stdout.split('\n');
    arrTab.forEach(element => {
      if (element.includes(matchString)) {
        tabId = element
          .split(' ')[0]
          .replace('[', '')
          .replace(']', '');
      }
    });
    reloadTab(tabId);
  });
}

refreshChromeTab(adminDashboard);

RUN COMMAND

nodemon  -e js,styl  refresher.js 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published