Thursday, December 29, 2016

No width parameter for SPAN tags, so limit width with javascript

$('span').each(function(index, value) {
  var limit = 30;
  var myID = $(this).attr('id');
  if(myID=='decoderip') {
   limit=60;
  }
  var mytext = $(this).text();
  if (mytext.length > limit) {
   // console.log('span text: '+mytext);
   $(this).text(mytext.slice(0, limit) + '...');
  }
 });

Monday, December 19, 2016

Time seconds increment on class of elements


function updateAge() {
 $('.age').each(function(){
  var age=$(this).text();
  age++;
  $(this).text(age);
 })
}

$(document).ready(function(){
  console.log('document ready'); 
  setInterval(updateAge, 1000); 
})

Thursday, December 1, 2016

Debian Package Creator and Installer

I made this for a particular "product", change the directory variables and final archived .deb filename per your needs.

debian.build.install.sh
#!/usr/bin/env bash
# this.is.lance.miller@gmail.com
clear;
basedir='/home/';
microdir=$basedir"micro/";
chmod 0775 $microdir'DEBIAN/postinst';
myfile=$microdir'DEBIAN/control';
echo $myfile;
myversion=`cat $myfile | grep Version | cut -d' ' -f2`;
echo $myfile' declares version '$myversion;
dpkg-deb --build $microdir;
ls -l $basedir*.deb;
sleep 5;
dpkg -i $basedir'micro.deb';
ls -l $basedir*.deb;
newfile='our_product_name_'$myversion'_all.deb';
echo 'creating this versioned deb archive: '$newfile;
mv $basedir'micro.deb' $basedir$newfile;
ls -l $basedir*.deb;