Skip to content

Instantly share code, notes, and snippets.

View mikbox74's full-sized avatar
🏠
Working from home

Michail mikbox74

🏠
Working from home
View GitHub Profile
@mikbox74
mikbox74 / plural.php
Last active June 11, 2019 12:51
Russian plural form for PHP
<?php
$string = '7 - 21';
echo preg_replace([
'/1[1-9]{1}$/',
'/[1]{1}$/',
'/[2-4]{1}$/',
'/[0,5-9]{1}$/',
], [
'$0 дней',
'$0 день',
@mikbox74
mikbox74 / script.js
Created April 3, 2019 18:45
Unputmask + autofill
jQuery(function(){
//autofill event hack
$('input.phone').one('animationstart', function(e, f) {
var animationName = e.originalEvent.animationName;
console.log(animationName);
if (animationName == 'onAutoFillCancel') {
$(this).inputmask("+7 (999) 999-99-99");
}
});
@mikbox74
mikbox74 / Selctize.php
Created June 2, 2018 11:20
2amigos/yii2-selectize-widget: how to set up default value when options are customized
<?php
namespace common\modules\appearance\widgets\backend;
use yii\web\JsExpression;
/**
* Selectize customization
*
* @author Michail Urakov