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 / instagram.php
Created January 3, 2017 17:46
Get recent images from Instagram using PHP & cURL
<?php
/**
* Supply a user id and an access token
* Jelled explains how to obtain a user id and access token in the link provided
* @link http://jelled.com/instagram/access-token
*/
$userid = "";
$accessToken = "";
// Get our data
function fetchData($url){
@faiyazalam
faiyazalam / custom-woocommerce-status.php
Created September 21, 2017 17:51
This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
<?php
/**
* @package Faiyaz_Custom_WC_Status
* @version 1.6
*/
/*
Plugin Name: Custom WooCommerce Status
Description: This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
Author: Faiyaz Alam
Version: 1.0
@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 / 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 / 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 / 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 / array-insert-after.php
Created December 29, 2018 04:43 — forked from wpscholar/array-insert-after.php
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*
@faiyazalam
faiyazalam / sample-virtual-host-pimcore-5.txt
Created November 13, 2018 05:28
Sample virtual host for PimCore -5
<VirtualHost *:80>
ServerName pim553bundle.local
DocumentRoot /var/www/html/pimcore/web
<Directory /var/www/html/pimcore/web/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
@faiyazalam
faiyazalam / mo
Created May 15, 2018 10:11
How to modify post data in the request object - Symfony - PIMCORE ?
//In service file: /var/www/html/pimcore/src/AppBundle/Resources/config/services.yml
AppBundle\EventListener\TestListener:
tags:
- { name: kernel.event_listener, event: kernel.request }
//In listner file: /var/www/html/pf/src/AppBundle/EventListener/UserListener.php
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class TestListener {