Zip and UnZip with FTP

Find here the PHP script, just upload.

 

  • Upload zipCF.php on the directory which you want to make zip file
  • Open zipCF.php with your browser
  • Provide a Name for the zip file
  • Click on Create Zip file
  • It will create the zip file if everything is ok and provide a success message just below the submit button
  • If you see the success message, go to ftp client or browse direct url to zip file from your browser
  • Download the newly created zip file
  • Use it anyhow you need
  • Delete zipCF.php file from your server to avoid security issues

 

How can I import a database with MySQL from terminal?

Prompt for password:

 mysql -u username -p databasename < filename.sql  

Enter password directly (not secure):

 mysql -u username -pPlainPassword databasename filename.sql 

Example:

mysql -u root -p wp_users < wp_users.sql

mysql -u root -pPassword123 wp_users --default-character-set=utf8 < wp_users.sql

See also:
4.5.1.5. Executing SQL Statements from a Text File

Empty File Using echo Command

# echo "" > access.log
OR
# echo > access.log

Note: You should keep in mind that an empty string is not the same as null. A string is already an object much as it may be empty while null simply means non-existence of an object.

For this reason, when you redirect the out of the echo command above into the file, and view the file contents using the cat command, is prints an empty line (empty string).

To send a null output to the file, use the flag -n which tells echo to not output the trailing newline that leads to the empty line produced in the previous command.

# echo -n "" > access.log

How to Fix Drop Down Menu not Working on iPad


jQuery(document).ready(function($){

    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
     $(".main-navigation li:has(ul) > a").bind('touchstart',function(e){

        e.stopPropagation();
    	e.preventDefault();

		if($(this).hasClass("oneTouch")){
  			$(this).removeClass("oneTouch");
  			window.location = $(this).attr("href");
  		}
		else{
			$(this).addClass("oneTouch");
		}

     });
    }

});

» Read more

Bootstrap 3 Carousel randomize item (Snippet)

$('#myCarousel.carousel[data-type="multi"] .item').each(function(){

  $('#myCarousel.carousel[data-type="multi"] .item').removeClass('active').eq(Math.floor((Math.random() * $('#myCarousel.carousel[data-type="multi"] .item').length))).addClass("active");    
  var next = $(this).next();
  
    
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));
  
  for (var i=0;i<4;i++) {
    next=next.next();
    if (!next.length) {
        next = $(this).siblings(':first');
  	}
    
    next.children(':first-child').clone().appendTo($(this));
  }
});