Skip to content

Instantly share code, notes, and snippets.

View faiyazalam's full-sized avatar
💭
Coding...

Faiyaz Alam faiyazalam

💭
Coding...
View GitHub Profile
@faiyazalam
faiyazalam / event-loop.md
Created February 22, 2019 12:09 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@faiyazalam
faiyazalam / Pimcore-Pagination-Twig
Created May 5, 2019 05:36
Sample implementation of pagination using Zend Paginator and Twig template in Pimcore 5?
//Controller
public function indexAction(Request $request) {
$products = new DataObject\Product\Listing();
$paginator = new \Zend\Paginator\Paginator($products);
$paginator->setCurrentPageNumber($request->get('page'));
$paginator->setItemCountPerPage(20);
return $this->renderTemplate('Controller/index.html.twig', [
'paginator' => $paginator
@faiyazalam
faiyazalam / gist:6078dc16d9aa1834f95cf2f3d3108885
Created January 20, 2020 06:50
How to do git clone in a non empty directory?
git clone repo-url tmp && mv tmp/.git . && rm -rf tmp && git reset --hard
Explaination:
1) Do git clone in a tmp directory from current directory
2) move .git from tmp to the parent directory of tmp directory
3) reset git from the current directory
@faiyazalam
faiyazalam / How-to-run-composer-with-a-specifig-PHP-version-on-cPanel.txt
Created January 26, 2020 08:15
How to run composer with a specifig PHP version on cPanel?
syntax:
COMPOSER_MEMORY_LIMIT=-1 php-path composer-path update
example:
1) COMPOSER_MEMORY_LIMIT=-1 ea-php72 /opt/cpanel/composer/bin/composer update
2) COMPOSER_MEMORY_LIMIT=-1 /opt/cpanel/ea-php72/root/usr/bin/php /opt/cpanel/composer/bin/composer update
@faiyazalam
faiyazalam / cpanel-cron-job.txt
Last active May 14, 2020 06:55
How to create a Cron job in cPanel - Symfony Pimcore ?
Here is a sample command:
/usr/local/bin/ea-php72 /home/atunp/public_html/bin/console app:test
@faiyazalam
faiyazalam / pimcore-migration-command.txt
Last active October 5, 2021 17:06
Pimcore Migration Command
bin/console pimcore:migrations:migrate -s pimcore_core -n
Run this command after composer update.
@faiyazalam
faiyazalam / pimcore10-docker-compose.yml
Created August 31, 2022 05:43
Pimcore 10.x Docker compose file
services:
redis:
image: redis:alpine
command: [ redis-server, --maxmemory 128mb, --maxmemory-policy volatile-lru, --save "" ]
db:
image: mariadb:10.7
working_dir: /application
command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-per-table=1]
volumes:
@faiyazalam
faiyazalam / access environment variable in web encore - pimcore symfony.txt
Created January 27, 2023 14:50
access environment variable in web encore - pimcore symfony
//inside webpack config file
var Encore = require('@symfony/webpack-encore');
var dotenv = require('dotenv');
Encore
// ...
// define the environment variables
.configureDefinePlugin(options => {
const env = dotenv.config();
@faiyazalam
faiyazalam / script.sh
Last active March 25, 2023 03:07
script to install zeromq php extension - Tested with Pimcore 10 and Official Docker Compose
apt-get update
apt-get install -y build-essential libtool autoconf uuid-dev pkg-config libsodium-dev libzmq3-dev
git clone https://github.com/zeromq/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install
docker-php-ext-enable zmq
#now restart php-fpm container
#container info:
#No LSB modules are available.
@faiyazalam
faiyazalam / Dockerfile
Last active March 25, 2023 03:39
Sample docker file to create pimcore 10 instance with php ZMQ extension
FROM pimcore/pimcore:PHP8.1-fpm
RUN apt-get update
RUN apt-get install -y build-essential libtool autoconf uuid-dev pkg-config libsodium-dev libzmq3-dev
RUN git clone https://github.com/zeromq/php-zmq.git
RUN cd php-zmq && phpize && ./configure
RUN cd php-zmq && make && make install
RUN docker-php-ext-enable zmq
RUN cd /var/www/html/ && rm -rf php-zmq/