This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- install plagins --> | |
| npm install --save-dev <name-plagins> | |
| <!-- rename file --> | |
| gulp-rename | |
| gulp-sass | |
| <!-- добавляет префиксы производителей --> | |
| gulp-autoprefixer | |
| gulp-sourcemaps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isNotEmpty = fieldName => fieldValue => fieldValue.trim().length > 0 || fieldName[0].toUpperCase() + fieldName.slice(1) + ' is required.'; | |
| const fieldName = isNotEmpty('name'); | |
| let isValid = fieldName('David'); | |
| console.log(isValid); // true | |
| isValid = fieldName(''); | |
| console.log(isValid); // Name is required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const validateEmail = email => /^[^@ ]+@[^@ ]+\.[^@ \.]+$/.test(email); | |
| const isValidEmail = function(value) { | |
| if (validateEmail(value)) { | |
| return true; | |
| } else { | |
| return "Please enter a valid email address"; | |
| } | |
| } | |
| let isValid = isValidEmail('abc@gmail.com'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $js = <<< JS | |
| alert("okey!"); | |
| JS; | |
| $this->registerJs( $js, $position = yii\web\View::POS_READY, $key = null ); | |
| // $key - ключ, который идентифицирует кодовый блок JS. | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <!-- Required meta tags --> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <!-- Bootstrap CSS --> | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get_params_url(param_name = false) | |
| { | |
| var search = window.location.search.substr(1), | |
| params = {}; | |
| if (search == '') return false; | |
| search.split('&').forEach(function(item) { | |
| item = item.split('='); | |
| params[item[0]] = item[1]; | |
| }); | |
| if (param_name) return params[param_name]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| trim($string, ','); | |
| rtrim(); | |
| ltrim(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| array.forEach(callbackFunction, [, thisArg]); | |
| // thisArg is optional | |
| //arguments for callback | |
| FunctioncallbackFunction(item, index , array) { | |
| //index, array is optional} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- circle --> | |
| <svg width="100" height="100"> | |
| <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> | |
| </svg> | |
| <!-- rect --> | |
| <svg width="400" height="100"> | |
| <rect width="400" height="100" style="fill:rgb(0,0,255); stroke-width:10; stroke:rgb(0,0,0)" /> | |
| </svg> |