This file contains 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
// | |
// Исходные данные | |
// | |
var phone = "0631112233"; | |
// | |
// Логика преобразований | |
// | |
var phone_is_valid = false; | |
var phone_numeric = new String(phone).replace(/[^\d]+/g, ""); |
This file contains 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
var $msCart = $("#msCart"); | |
$('.catalog__item__cart.in_basket').each(function(){ | |
var $icon = $(this); | |
var productID = $icon.data("id"); | |
if(productID) { | |
if($msCart.find("[data-number='" + productID + "']").length > 0) | |
$icon.removeClass("hidden"); |
This file contains 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 | |
if(!defined('MICROTIME_START')) { define('MICROTIME_START', microtime(true)); } | |
if(!function_exists('mytrace')) {function mytrace () { static $cnt=0, $h=20; $diff=round(microtime(true)-MICROTIME_START,3); if(isset($_COOKIE['EC']) && 'Y' === $_COOKIE['EC']) { | |
$trace = reset(debug_backtrace()); $style='text-shadow: 0px 1px 0 #b0b0b0;border-bottom:1px solid lightgray;padding:3px;font-size:12px;font-family:arial;background:rgba(255,255,255,.8);position:absolute;left:0;top:'.(140+$cnt*$h).'px;z-index:9999;height:'.$h.'px;width:100%;box-sizing:border-box;'; | |
echo PHP_EOL.'<pre style="'.$style.'">[TRACE] ('.$diff.'s) '.$trace['file'].':'.$trace['line'].'</pre>'.PHP_EOL; | |
++$cnt; | |
}}} | |
if(!function_exists('mydie')) {function mydie () { if(isset($_COOKIE['EC']) && 'Y' === $_COOKIE['EC']) die; }} | |
// P.S. COOKIE "EC" must be set value "Y" |
This file contains 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
СтоимостьКирпича = 2.5 // (грн) | |
ШиринаКирпича = 0.230 // (м) | |
ВысотаКирпича = 0.065 // (м) | |
ШиринаСтены = 12 // (м) | |
ВысотаСтены = 3 // (м) | |
КоличествоСтен = 4 // (шт) | |
КоличествоКирпичейНаСтену = (ШиринаСтены / ШиринаКирпича) * (ВысотаСтены / ВысотаКирпича) | |
ЦенаЗаСтену = КоличествоКирпичейНаСтену * СтоимостьКирпича | |
ЦенаЗаСтены = ЦенаЗаСтену * КоличествоСтен | |
Результат = "Для стен (" + КоличествоСтен + " шт) нужно кирпичей (" + КоличествоКирпичейНаСтену + " шт) по сумарной цене " + ЦенаЗаСтены + " грн." |
This file contains 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 | |
namespace app\rest; | |
use yii\filters\AccessControl; | |
use yii\filters\auth\CompositeAuth; | |
use app\components\HeaderParamAuth; | |
/** | |
* Description of ActiveController |
This file contains 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
document.title = '[WS] Connected..'; | |
(function(){ | |
// config | |
var HOST = 'example.com' | |
var PORT = 3311 | |
var USER_ID = 1000; | |
// connect |
This file contains 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
/** | |
* @author Hryhorii Furletov <[email protected]> | |
* | |
* @example | |
* (new CommandReader).runYii('config/database').then((databaseConfig) => { }); | |
* (new CommandReader).runYii('/usr/bin/php', 'configJson.php').then((databaseConfig) => { }); | |
*/ | |
'use strict' | |
const spawn = require('child_process').spawn; |
This file contains 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 | |
$keywords = 'aa,bb,cc'; | |
function splitGenerator($haystack, $separator = ',') | |
{ | |
$separatorPos1 = -1; | |
while (true) { | |
$separatorPos2 = mb_strpos($haystack, $separator, $separatorPos1 + 1); | |
if (false === $separatorPos2) { | |
$chunk = mb_substr($haystack, - (mb_strlen($haystack) - $separatorPos1 - 1)); |
This file contains 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 | |
$array = new SplFixedArray(2); | |
$array[0] = 'A'; | |
$array[1] = 'B'; | |
$offset = 0; | |
if ($array->offsetExists($offset)) { | |
$sizeNew = $array->getSize() - 1; | |
for ($i = $offset; $i < $sizeNew; ++$i) { | |
$array[$offset] = $array[$offset + 1]; | |
} |
This file contains 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 | |
class PmlMatchType implements \JsonSerializable | |
{ | |
const EXACT = 0b001; | |
const BROAD = 0b010; | |
const EXACT_COMBO = 0b100; | |
const EXACT_TEXT = 'Exact'; | |
const BROAD_TEXT = 'Broad'; |
OlderNewer