Friday, January 31, 2020

Javascript find highest and lowest from the given inputs

function highAndLow(numbers){
// numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"
  let numbersInArr = numbers.split(' ').map(Number)
  let min = Math.min(...numbersInArr);
  let max = Math.max(...numbersInArr);
  let result = max +' '+min
  return result;
}

Friday, January 9, 2015

Javascript Jquery OS Browser detection

Javascript-Jquery


if (navigator.appVersion.indexOf("Win")!=-1){
     ff=navigator.userAgent.search("Firefox");
     if(ff>-1){
      $("#nav a").addClass('padding-right');
     }
 }
 else{
  $("#nav a").removeClass('padding-right');    
 }

CSS


body{
    font-family:arial;
}
#nav a{
    width:120px;
    height:40px;
    display:block;
    line-height:40px;
    background: #EA7A0C;
    color:#fff;
    text-align:center;
    font-size:13px;
    text-decoration: none;
}
.padding-right{
    padding-right:100px;
}

Friday, June 6, 2014

Responsive navbar collapse for single page applications

var windowWidth = $(window).width();
if(windowWidth <=767){
 collapse();
}
else{
 
}
function collapse(){
$('.navbar-collapse').click('li', function() {
  $('.navbar-collapse').collapse('hide');
 });
}

Tuesday, May 20, 2014

Grunt Watch Fatal error: listen EACCES and livereload

//Change the port
 connect: {
            options: {
                port: 8080,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },

Fatal error: unable to find Gruntfile.

//  grunt is installed locally, as verified by
npm ls | grep grunt

Friday, May 16, 2014

Git- clone the existing github project into the local repository

// just git clone steps
git clone https://github.com/ssthil/AngularJS-Yeoman.git
// just check bower version
bower --v
1.3.3

// just check npm version
npm --v
1.3.24

// just check grunt version
grunt -version
grunt-cli v0.1.13
grunt v0.4.5

//if you are still getting error like, Fatal error: unable to find local grunt then run this
npm install grunt --save-dev

// just check ruby version
ruby -version

// just check compass version
compass -version

// npm install
npm install

// bower install
npm install -g bower

// exit from window Git Bash
exit

// bower install
npm install bower

// bower install run this command
./node_modules/bower/bin/bower install

Thursday, May 15, 2014

Port 35729 is already in use by another process

This usually happens when there's another Terminal window open, it works after closing the other terminal window.

Javascript find highest and lowest from the given inputs

function highAndLow(numbers){ // numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"   let numbersInArr = numbers.split(' '...