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 | |
/** | |
* Validates a credit card number using an array of approved card types. | |
* | |
* @param $number | |
* The credit card number to validate. | |
* @param $card_types | |
* An array of credit card types containing any of the keys from the array | |
* returned by commerce_payment_credit_card_types(). Only numbers determined |
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 | |
$source = [ | |
'color' => ['red','blue','white','yellow','black'], | |
'who' => ['rabbit','bear','wolf'], | |
'else' => ['in space','in Russia','is hungry','is dead'] | |
]; | |
var_dump(recursion_calculate($source)); |
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 | |
function parseClasses($classes){ | |
return explode(' ', preg_replace('/[\t\s]+/',' ', trim($classes))); | |
} | |
function addBodyClass($class){ | |
global $APPLICATION; | |
$classes = parseClasses($APPLICATION->GetPageProperty('body_class')); | |
$add = parseClasses($class); |
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 | |
define('ROOT', $_SERVER['DOCUMENT_ROOT']); | |
class AutoLoader { | |
private static $possible = array(); | |
private static $events = array(); | |
public static function load($class){ |
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
javascript:(function(script){script.setAttribute('src','https://rawgit.com/ivansky/cssrefresh.js/master/cssrefresh.min.js');var head=document.querySelector('head').appendChild(script);})(document.createElement('script')); |
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 | |
function test($str){ | |
list($var) = explode('/', $str); | |
return $var; | |
} | |
function test2($str){ | |
$var = array_shift(explode('/', $str)); | |
return $var; |
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
# Bitrix Example | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$ | |
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L] | |
#RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] | |
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}] |
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 | |
/** | |
* Remove from string all invalid characters | |
* Leave only English, Russian, Turkish, Kazakh and Numbers | |
* @link http://www.unicode.org/charts/ | |
* @param string $w | |
* @return string | |
*/ | |
function prepareSearchKeyword($w){ |
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 YADWord { | |
private static $bind_region = array(); | |
private static $bind_crc = array(); | |
public $region_id = 213; | |
public $original; |
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
type ScrollDirection = 'vertical' | 'horizontal' | 'both'; | |
/** | |
* It prevents default behaviour above the scrollable areas | |
* until it's in available scrollable direction. | |
* | |
* Example of checkScrollableElement: | |
* | |
* var cleanBlocking = ( | |
* blockOverScroll( |
OlderNewer