Skip to content

Instantly share code, notes, and snippets.

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

Artem flayder

🏠
Working from home
View GitHub Profile
function applyDiscount(string $coupon) {
$is_unused = Sale\DiscountCouponsManager::getEnteredCoupon($coupon);
if(!$is_unused) {
Sale\DiscountCouponsManager::add($coupon);
$oBasket = Sale\Basket::loadItemsForFUser(
Sale\Fuser::getId(),
Main\Context::getCurrent()->getSite()
);
$oDiscounts = Sale\Discount::loadByBasket($oBasket);
$oBasket->refreshData(['PRICE', 'COUPONS']);
Showing last 100 logs string
$ docker logs -f --tail 100
Build docker image
$ cd /path/to/Dockerfile
$ sudo docker build .
View running processes
$ sudo docker ps
View all processes
iptables -A INPUT -d [ip - сервера]/32 -p tcp -m tcp --dport [номер порта] -j ACCEPT
или дать разрешение для всех портов
сохранить текущие настройки
iptables-save > название файла
затем
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
добавить параметр socket-user=#uid в апач файл для pgadmin
строка
WSGIDaemonProcess pgadmin processes=1 threads=25 socket-user=#1001 python-home=/usr/pgadmin4/venv
команда для получения списка пользователей в системе
getent passwd
$ID = $_REQUEST["ID"];
if($ID > 0 && \Bitrix\Main\Loader::includeModule("sale") && \Bitrix\Main\Loader::includeModule("catalog")) {
$fuserId = CSaleBasket::GetBasketUserID();
$arOrder = CSaleOrder::GetByID($ID);
$dbBasketItems = CSaleBasket::GetList(
array(
"NAME" => "ASC",
"ID" => "ASC"
),
navigation.reset({
index: 1,
routes: [
{
name: 'Screen1',
state: {
routes: [{ name: 'Tab2' }],
},
},
{
navigation.dangerouslyGetParent()
const params = new URLSearchParams();
params.append('param1', 'value1');
params.append('param2', 'value2');
axios.post('/foo', params);
sudo chgrp -R ИМЯ ПОЛЬЗОВАТЕЛЯ storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function callback($buffer) {
if(strpos($_SERVER['HTTP_USER_AGENT'],'Chrome-Lighthouse') !== false) {