function hex2rgb( $colour ) {
if ( $colour[0] == '#' ) {
$colour = substr( $colour, 1 );
}
if ( strlen( $colour ) == 6 ) {
list( $r, $g, $b ) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] );
} elseif ( strlen( $colour ) == 3 ) {
list( $r, $g, $b ) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] );
} else {
return false;
}
$r = hexdec( $r );
$g = hexdec( $g );
$b = hexdec( $b );
return array( 'red' => $r, 'green' => $g, 'blue' => $b );
}
$rgbColor= hex2rgb('#C6CFD6');
echo $rgbColor['red'];
echo $rgbColor['green'];
echo $rgbColor['blue'];
aphpfan
I have a great passion on software development. I want to be a good software developer. And I am Interested in a challenging technical track career in secure web application development environment. Accomplished software engineer specializing in object-oriented approaches to platform development.
Tuesday, January 28, 2014
Sunday, January 26, 2014
Select2.js configuration
if (typeof $.fn.select2 != 'undefined')
{
var tags= 'one, two, three';
$("#selectTags").select2({
placeholder: "Select options",
selectOnBlur: false,
openOnEnter: true,
blurOnChange: true,
allowClear: false,
tags: tags
});
}
{
var tags= 'one, two, three';
$("#selectTags").select2({
placeholder: "Select options",
selectOnBlur: false,
openOnEnter: true,
blurOnChange: true,
allowClear: false,
tags: tags
});
}
wysihtml5 configuration
$('.wysihtml5').wysihtml5({
link: false,
'font-styles': true,
emphasis: true,
lists: true,
html: false,
image: false,
'color': true,
'format-code': false,
events: {
load: function() {
console.log('lodded');
}
}
});
link: false,
'font-styles': true,
emphasis: true,
lists: true,
html: false,
image: false,
'color': true,
'format-code': false,
events: {
load: function() {
console.log('lodded');
}
}
});
wysihtml5 field update
$(" #myfiled").val('');
$('#myfield').data("wysihtml5").editor.setValue('');
$('#myfield').data("wysihtml5").editor.setValue('');
Saturday, January 25, 2014
Remove seconds from toLocaleString
if you want to remove seconds from date local string you can use ... .
toLocaleString return Saturday, January 25, 2014 10:34:59 AM
var d = new Date();
d.toLocaleString().replace(/:\d{2}\s/,' ');
out putof this code is Saturday, January 25, 2014 10:34 AM
if you want add specific time then
var d = new Date(yourTimestamp*1000);
d.toLocaleString().replace(/:\d{2}\s/,' ');
toLocaleString return Saturday, January 25, 2014 10:34:59 AM
var d = new Date();
d.toLocaleString().replace(/:\d{2}\s/,' ');
out putof this code is Saturday, January 25, 2014 10:34 AM
if you want add specific time then
var d = new Date(yourTimestamp*1000);
d.toLocaleString().replace(/:\d{2}\s/,' ');
Subscribe to:
Posts (Atom)