Friday, October 2, 2015

Directory List to XML

<?php
header("Content-type: text/xml");
print "<?xml version='1.0' encoding='UTF-8'?>\n<response?>\n";
$files = glob('*.xml');
foreach($files as $file) {
 print "<file?>".$file."</file?>\n<!-- ".date("F d Y H:i:s.",filemtime($file))."--?>\n";
}
die('');
?>

Tuesday, August 11, 2015

GIT Rebase Basic with Force Push.

#!/usr/bin/env bash
echo "present working directory is:";
pwd;
echo ;
echo "enter your GIT project dir, or .(dot) followed by [ENTER]:"
read directory
cd $directory;
echo "present working directory is:";
pwd;

echo "enter name of experiment branch";
read experiment
echo $experiment
git checkout $experiment

echo "enter name of master branch";
read master
echo $master
git checkout $master
git rebase $master
echo "git push --force origin $experiment:$experiment WILL HAPPEN AFTER YOU PRESS ENTER";
read reply
git push --force origin $experiment:$experiment
exit;

Saturday, July 25, 2015

GIT checkout and reset --hard for all remote branches


#!/usr/bin/env bash
echo "present working directory is:";
pwd; 
echo ; 
echo "enter your GIT project dir, or .(dot) followed by [ENTER]:"
read directory
cd $directory;
echo "present working directory is:";
pwd; 
echo 'git fetch' 
git fetch
for branch in `git branch`; do
    echo "$branch";
    echo "git checkout $branch"
    git checkout $branch
    echo "git reset --hard origin/$branch"
    git reset --hard origin/$branch
    git log -1;
done
exit

Friday, July 17, 2015

Class.each with ajax for each

$('.routeInfo').each(function(){
    // 
    fid = $(this).attr("fid");
    id = $(this).attr("id");
    uniqueID = $(this).attr("uniqueID");
    $.ajax({
            url: '/route.php',
            type: 'GET',
            data: { fid: fid , user: 'fred' } ,
            success: function (response ) {
                 if(response.length > 5) {
                        $("#" + id).html('ROUTE STATUS: '+response);                   
                                     }  else {
                                     $("#" + id).html('ROUTE STATUS: Not Routed');
                                       }
            },
            error: function () { console.log('ajax error'); }
        });
     });  

Thursday, July 16, 2015

Button click animation

$("button").click(function(){
 this.animate({ opacity: '0.1'}, "slow" );
 this.animate({ opacity: '1.0'}, "fast");
});

Wednesday, July 8, 2015

Server side log of javascript user notification

<?php
 
$file = 'htmlMsg.txt'; 
 
$input=date("D M d, Y G:i a"); 
$input=$input."\n";
foreach($_REQUEST as $key=>$value) {
 $input=$input.$key.": ".$value."\n";
}

$filesize = (filesize($file) * .0009765625) * .0009765625; // bytes to MB
if($filesize > 1) {
 file_put_contents($file, $input); // overwrite and thus downsizing the $file
} else {
 file_put_contents($file, $input, FILE_APPEND);
}

die($filesize);  

// ajax call to this script.
// $.post("/ls/htmlMsg.php", { msg: htmlMsg }, console.log('posted htmlMsg') );
?>

Saturday, June 27, 2015

GIT New Branch Creator


#!/usr/bin/env bash
echo "present working directory is:";
pwd; 
echo ; echo "enter your GIT project dir, followed by [ENTER]:"
read directory
cd $directory;
echo "present working directory is:";
pwd; 
echo 'git branch -vvv;';
git branch -vvv;
echo "this is the branch you are on [ENTER]";  
read a 
echo ; echo "enter branch you want to hard reset and use as new branch, followed by [ENTER]:"
read branch
git fetch; 
git checkout  $branch; 
git reset --hard origin/$branch;
echo ; echo "enter the new branch name, followed by [ENTER]:"
read newBranch
git checkout -b $newBranch $branch;
git push -u origin $newBranch;
echo 'git branch -vvv;';
git branch -vvv;
echo "this is the branch you are on [ENTER]";