Skip to content

Instantly share code, notes, and snippets.

View clientlab-dev's full-sized avatar

КлиентЛаб clientlab-dev

View GitHub Profile
@clientlab-dev
clientlab-dev / Замена всех emoji
Created May 29, 2019 08:05
Замена всех emoji
replace(/[\uD83C-\uDBFF\uDC00-\uDFFF]+/g, '');
@clientlab-dev
clientlab-dev / Создание правил корзины Битрикс
Last active May 16, 2019 17:14
Создание правил корзины Битрикс из свойства элемента ИБ
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Test");
?>
<?php
use Bitrix\Sale\Internals;
CModule::IncludeModule("catalog");
CModule::IncludeModule("iblock");
CModule::IncludeModule("sale");
@clientlab-dev
clientlab-dev / gist:073cda06a0531a008d3f14b2b73617a6
Created March 28, 2019 14:26
Редирект для битрикса с безслеша на слеш
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.*/[^/\.]+)$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]
@clientlab-dev
clientlab-dev / loger.php
Created March 26, 2019 14:25
webhook loger
<? print_r($_REQUEST); writeToLog($_REQUEST, 'incoming'); /** * Write data to log file. * * @param mixed $data * @param string $title * * @return bool */ function writeToLog($data, $title = '') { $log = "\n------------------------\n"; $log .= date("Y.m.d G:i:s") . "\n"; $log .= (strlen($title) > 0 ? $title : 'DEBUG') . "\n"; $log .= print_r($data, 1); $log .= "\n------------------------\n"; file_put_contents(getcwd() . '/hook.log', $log, FILE_APPEND); return true; }
@clientlab-dev
clientlab-dev / gist:c9c2a2e60640356831a80dfa07aab4c1
Created March 20, 2019 10:46
Объеденение таблиц mySQL
CREATE TABLE new_table AS SELECT * FROM b_user_current UNION SELECT * FROM b_user_old WHERE EMAIL NOT IN (SELECT EMAIL FROM b_user_current) ORDER BY `DATE_REGISTER` DESC
var q = JSON.parse('{"' + decodeURI(jQuery(this).attr('href')).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
$data = array(
array(
'id'=>'0',
'title'=>'Te33s2t',
'content'=>'<h1>Test</h1>',
'link'=>'http://vk.com/'
),
array(
'id'=>'1',
'title'=>'Tes3333t2',
@clientlab-dev
clientlab-dev / .htaccess
Last active February 26, 2019 10:13
Bitrix .htaccess options
php_value mbstring.func_overload 2
php_value mbstring.internal_encoding UTF-8
php_value max_input_vars 11000
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
import React from 'react';
import { PropTypes } from 'prop-types';
class Ingredient extends React.Component{
static propTypes = {
amount: PropTypes.number,
}