Skip to content

Instantly share code, notes, and snippets.

View voeurnchy's full-sized avatar
🎯
Focusing

Voeurn Chy voeurnchy

🎯
Focusing
View GitHub Profile
@voeurnchy
voeurnchy / bk-price.js
Created April 6, 2018 04:49
make a back up original value
var price = self.custom_value2();
if(!price){
price = self.cost();
self.custom_value2(price);
}
@voeurnchy
voeurnchy / vaidate.php
Last active March 5, 2018 08:37
validation of image and countrycode
<?php
// add into AppServiceProvider::register()
Validator::extend('imageable', function ($attribute, $value, $params, $validator) {
try {
ImageManagerStatic::make($value);
return true;
} catch (\Exception $e) {
return false;
}
@voeurnchy
voeurnchy / explode.php
Last active July 31, 2020 08:54
Explode string with multiple delimiters
<?php
/**
* Explode with multiple delimiters
* @param array $delimiters
* @param string $string
* @return array
*/
function explodeX(array $delimiters, string $string )
{
return explode( chr( 1 ), str_replace( $delimiters, chr( 1 ), $string ) );