running scanner on arch linux

first all we need install packages called SANE

sudo pacman -S sane

then show list scanner we want use

$ scanimage -L
device `v4l:/dev/video0' is a Noname UVC Camera (eb1a:013a) virtual device
device `pixma:04A9174E_517EB0' is a CANON Canon PIXMA MX410 multi-function peripheral

the device called pixma:04A9xxxxxxx is my plug scanner, then input your document into scanner. and running this command on your fucking shell.

$scanimage --device pixma:04A9174E_517EB0 --format=tiff > result_scan.tiff

and fucking done bro. (install frontend for scanner ex: simple-scan make you easier)


word_limit with javascript

create this function

function truncate( n, useWordBoundary ){
	var isTooLong = this.length > n,
	s_ = isTooLong ? this.substr(0,n-1) : this;
	s_ = (useWordBoundary && isTooLong) ? s_.substr(0,s_.lastIndexOf(' ')) : s_;
	return  isTooLong ? s_ + '…' : s_;

how to use?

var string = "Hello world one two three four five six seven eight nine ten";
truncate.apply(string, [10, true])

source: stackoverflow

set to first value select2


<select id="myselect2" class="select2-using">
<option value="">Select Car</option>
<option value="BMW">BMW</option>
<option value="Mazda">Mazda</option>
<option value="L300">L300</option>



solving with this

$('#myselect2').val($('#myselect2 option:first-child').val()).trigger('change');

Strtotime with javascript

function convertDate(inputFormat) {
	function pad(s) { return (s < 10) ? '0' + s : s; }
	var d = new Date(inputFormat);
	return [pad(d.getDate()), pad(d.getMonth()+1), d.getFullYear()].join('/');

for using

var ex_date = '2016-06-15';
var after_convert_date = convertDate(date);