Закомментировать данный код в chosen.jquery.js

    AbstractChosen.browser_is_supported = function() {
      /*
	  if ("Microsoft Internet Explorer" === window.navigator.appName) {
        return document.documentMode >= 8;
      }
      if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
        return false;
      }
	  */
      return true;
    };
Categories: Javascript Tags:

Для нормальной работы ui на мобильных устройствах подключить https://github.com/furf/jquery-ui-touch-punch

Categories: Javascript Tags:
$(document).ready(function(){
	var sync1=$("#owl_detail");
	var sync2=$("#owl_thumbs");
	var slidesPerPage=4;
	var syncedSecondary=false;
	sync1.owlCarousel({
		items:1,
		//slideSpeed:2000,
		nav:true,
		autoplay:false,
		dots:false,
		loop:false,
		//responsiveRefreshRate:200,
	}).on('changed.owl.carousel',syncPosition);
	sync2.on('initialized.owl.carousel',function(){
		sync2.find(".owl-item").eq(0).addClass("current");
	}).owlCarousel({
		items:slidesPerPage,
		dots:false,
		nav:false,
		loop:false,
		margin:25,
		//smartSpeed:200,
		//slideSpeed:500,
		//slideBy:slidesPerPage,
		//responsiveRefreshRate:100
	}).on('changed.owl.carousel',syncPosition2);
	function syncPosition(el){
		/*
		var count=el.item.count-1;
		var current=Math.round(el.item.index-(el.item.count/2)-.5);
		if(current<0){
			current=count;
		}
		if(current>count){
			current=0;
		}
		*/
		var current=el.item.index;
		sync2.find(".owl-item").removeClass("current").eq(current).addClass("current");
		var onscreen=sync2.find('.owl-item.active').length-1;
		var start=sync2.find('.owl-item.active').first().index();
		var end=sync2.find('.owl-item.active').last().index();
		if(current>end){
			sync2.data('owl.carousel').to(current,100,true);
		}
		if(current<start){
			sync2.data('owl.carousel').to(current-onscreen,100,true);
		}
	}
	function syncPosition2(el){
		if(syncedSecondary){
			var number=el.item.index;
			sync1.data('owl.carousel').to(number,100,true);
		}
	}
	sync2.on("click",".owl-item",function(e){
		e.preventDefault();
		var number=$(this).index();
		sync1.data('owl.carousel').to(number,300,true);
	});
});
<div class="large">
	<div class="owl-carousel owl-theme" id="owl_detail">
		<div class="item">
			<img src="images/detail_1.jpg" alt=""/>
		</div>
		<div class="item">
			<img src="images/detail_2.jpg" alt=""/>
		</div>
	</div>
</div>
<div class="thumbs">
	<div class="owl-carousel owl-theme" id="owl_thumbs">
		<div class="item">
			<img src="images/detail_1.jpg" alt=""/>
		</div>
		<div class="item">
			<img src="images/detail_2.jpg" alt=""/>
		</div>
	</div>
</div>
Categories: Javascript Tags:

Как, например, xml:

if($dir=opendir(ROOT_DIR.IMPORT_DIR)){
	while(false!==($file=readdir($dir))){
		if(is_file(ROOT_DIR.IMPORT_DIR.$file)){
			$offers=@simplexml_load_file(ROOT_DIR.IMPORT_DIR.$file);
			if($offers){
				print_pre($offers);
			}
		}
	}
}

Или csv:

if($dir=opendir(ROOT_DIR.IMPORT_DIR)){
	while(false!==($file=readdir($dir))){
		if(is_file(ROOT_DIR.IMPORT_DIR.$file)){
			if(($handle=fopen(ROOT_DIR.IMPORT_DIR.$file,"r"))!==false){
				while(($item=fgetcsv($handle,10000,";"))!==false){
					print_pre($item);
				}
			}
		}
	}
}
Categories: PHP Tags:
10 марта 2020 Нет комментариев

shell скрипт для автоматического изменения кодировки таблиц и столбцов с utf8 на utf8mb4

#!/bin/bash
 
# mycollate.sh <database> [<charset> <collation>]
# changes MySQL/MariaDB charset and collation for one database - all tables and
# all columns in all tables
 
DB="$1"
CHARSET="$2"
COLL="$3"
 
AUTH="-uuser -ppass"
 
[ -n "$DB" ] || exit 1
[ -n "$CHARSET" ] || CHARSET="utf8mb4"
[ -n "$COLL" ] || COLL="utf8mb4_general_ci"
 
echo $DB
echo "ALTER DATABASE \`$DB\` CHARACTER SET $CHARSET COLLATE $COLL;" | mysql $AUTH
 
echo "USE \`$DB\`; SHOW TABLES;" | mysql -s $AUTH | (
	while read TABLE; do
		echo $DB.$TABLE
		echo "ALTER TABLE \`$TABLE\` CONVERT TO CHARACTER SET $CHARSET COLLATE $COLL;" | mysql $AUTH $DB
	done
)

https://dba.stackexchange.com/questions/8239/how-to-easily-convert-utf8-tables-to-utf8mb4-in-mysql-5-5

Categories: Mac, Unix Tags: ,
25 февраля 2020 Нет комментариев

Добавить muted=true, например:

v.muted=true;
v.play();
Categories: Javascript Tags:
17 февраля 2020 Нет комментариев

Автоматический перезапуск mariadb если она не активна (Script for checking mariadb status and restarting if it is inactive).
Скрипт:

#!/bin/bash
STATUS=$(/bin/systemctl is-active mariadb.service);
if [ $STATUS != 'active' ]
then
	/bin/systemctl restart mariadb.service
fi

Cron (каждые 5 минут)

*/5 * * * * /var/scripts/check_mariadb.sh
Categories: Unix Tags: ,