Skip to content

Instantly share code, notes, and snippets.

@rohithmeethal
rohithmeethal / ProductSubscriber.php
Last active December 21, 2022 17:52
In Shopware 6, how to know if written product is new or existing fromr product written event
<?php
declare(strict_types=1);
namespace MyPlugin\Subscriber;
use Shopware\Core\Content\Product\ProductEvents;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
<?php
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
@rohithmeethal
rohithmeethal / installation.md
Created June 9, 2021 10:38
Latest version php7.4-imagick with 260 format support.
  1. Remove all the imagemagick in the system : sudo apt remove imagemagick php7.4-imagick && sudo apt autoremove
  2. Install latest version of imagemagick using imei https://softcreatr.github.io/imei/ (Took 8 minutes in a 8 core system)
  3. Install pecl and php7.4-dev sudo apt install php7.4-dev php-pear
  4. Install php imagick using pecl sudo pecl install imagick
  5. Enable module sudo phpenmod imagick
  6. Restart the server sudo service php7.4-fpm restartor sudo service apache2 restart
@rohithmeethal
rohithmeethal / gist:a7e03c49a0f0e43f2aa5fcfc0987577e
Created April 30, 2020 19:18
virtual-box-internet-and-ssh
If you want to access vb guest using ssh also have internet access from vb guest.
Then you need to add two network cards to guest one NAT network and one HOST only adapter.
#!/bin/bash
export TERM=xterm-256color
function tinkerwatch(){
clear;
tail -n $(expr $(wc -l $1 | awk '{ print $1 }') - 1) $1 | php artisan tinker
}
tinkerwatch $1
@rohithmeethal
rohithmeethal / .zshrc
Created March 29, 2020 10:03
Setting up permission to make it writable for apache group while in users directory
function fixpermissions(){
sudo chgrp -R www-data $1
sudo chown -R $(whoami):www-data $1
sudo chmod -R g+s $1
sudo chmod -R 775 $1
}
add this to your .zshrc or bashrc
use it like "fixperssmissions foldername"
@rohithmeethal
rohithmeethal / multiple php version
Created March 29, 2020 09:06
For development system setup
follow this guide https://devanswers.co/run-multiple-php-versions-on-apache/
TLDR:
sudo apt install php7.2 php7.2-fpm
sudo a2enmod actions alias proxy_fcgi fcgid
two ways to activate php version :
1) for using virtual host file method
@rohithmeethal
rohithmeethal / Headset microphone fix for ASUS FX 553 VD ubuntu.txt
Created March 24, 2020 19:18
Headset microphone fix for ASUS FX 553 VD ubuntu
Add this line "options snd-hda-intel model=alc233-asus"
At end of file "/etc/modprobe.d/alsa-base.conf"
@rohithmeethal
rohithmeethal / update-query.sql
Created February 25, 2019 14:11
Make prices same in shopware for various tax groups
SET @sourceCustomerGroupKey = 'EK';
SET @destinationPriceGroupKey = 'ATK';
UPDATE s_articles_prices DESTINATION_PRICES
INNER JOIN s_articles_prices AS SOURCE_PRICES
ON SOURCE_PRICES.`pricegroup` = @sourceCustomerGroupKey AND
SOURCE_PRICES.`from` = DESTINATION_PRICES.`from` AND
SOURCE_PRICES.`to` = DESTINATION_PRICES.`to` AND
SOURCE_PRICES.`articleID` = DESTINATION_PRICES.`articleID` AND
SOURCE_PRICES.`articledetailsID` = DESTINATION_PRICES.`articledetailsID` AND
@rohithmeethal
rohithmeethal / pstorm
Created August 12, 2018 10:30
Phpstorm startup file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import sys
import os
import time
# see com.intellij.idea.SocketLock for the server side of this interface