Wednesday, August 10, 2016

jQuery Dialog zIndex


$( ".selector" ).dialog();

$( ".selector" ).css("background-color", "red");

console.log( 'z-index ' + $( ".selector" ).zIndex()     );

Tuesday, April 5, 2016

Make Sure Element is Visible and Displayed : Javascript

function makeVisible(id) {
 if($('#'+id).css('display') == 'none') {
 $('#'+id).css('display','block');
 }
 if($('#'+id).css('visibility') == 'hidden') {
 $('#'+id).css('visibility','visible');
 }
 console.log('makeVisible visibility '+$('#'+id).css('visibility'));
 console.log('makeVisible display  '+$('#'+id).css('display'));
}

function testPreviewImage() {
 makeVisible('Preview_Div');
 makeVisible('Preview_Image');
 $('#Preview_Div').zIndex(16777261);
 $('#Preview_Image').zIndex(16777271);
}

Tuesday, December 22, 2015

Smooth expansion of DIV with jQuery

var bigWidth=800;
$("#map").width() == bigWidth ?
 $("#map").fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).animate({ height: 400, width: 400 }) :
 $("#map").fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300).animate({ height: 400, width: 800 });

Tuesday, December 15, 2015

Javascript padding


 function pad(str, character, max, side, visibility) {
  str = str.toString();
  console.log('inside pad: '+str);
  var pad;
  var output;
  pad='';
  for (var i=str.length;i<max;i++ ) {
       pad = pad + character;
  }
  pad="<span style='visibility:"+ visibility + "'>" + pad + "</span>";
  side=='left'?  output=pad+str : output=str+pad ;
  return output;
 }

input=$('#serialnumber').text(); 
$('#serialnumber').html(  pad( input, 'F', 16, 'right', 'hidden')  );

Wednesday, November 4, 2015

GIT Merge Tool : Very Basic

#!/usr/bin/env bash
git branch -vvv;
echo "intergration branch:"
read int
echo "branch to merge:"
read mergebranch
git checkout $int && git merge --no-edit --no-ff $mergebranch
# example:  git checkout lm/generalLake && git merge --no-edit --no-ff origin/lm/ottersSwim

MySQL Count Duplicates

#!/usr/bin/env bash
echo "Table to read:"
read table
echo "Column to count and display:"
read col
echo "Threshold number:"
read num
echo "SELECT $col FROM $table GROUP BY $col HAVING count(*) > $num;";

Useage

Table to read: geocodes Column to count and display: ip Threshold number: 2 SELECT ip FROM geocodes GROUP BY ip HAVING count(*) > 2;

GIT Checkout Loop

#!/usr/bin/env bash



while true
do
 git fetch --prune; 
        git branch -vvv
 echo "provide branch name to checkout:"
 read branch
        git checkout $branch;
        git pull;
        git log --decorate --pretty=tformat:'%h %d %ar %s' --first-parent --reverse -30;
        git log -1
 $1  # arg to import a command, such as 'exit'
done