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 / 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 / raw-sql-query-pimcore-db
Created May 21, 2018 13:58
Raw sql query using Pimcore\Db class in PIMCORE 5
use Pimcore\Db;
$sql = "SELECT * from table_name where`id` = ?";
$stmt = Db::get()->prepare($sql);
$stmt->bindParam(1, 101, \PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll();
@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 {
@faiyazalam
faiyazalam / wp-list-table-custom.php
Created April 3, 2018 12:58
WP_List_Table - Custom
<?php
/*
Plugin Name: WordPress - WP_List_Table - Custom
*/
add_action( 'admin_menu','register_my_custom_menu_page');
function register_my_custom_menu_page(){
global $new_menu_page;
// creating admin menu
<?php
/**
* Plugin Name: EDD Heartbeat API test plugin
* Description: Demonstrates how to use the Heartbeat API to update the payments count on the dashboard
*/
// Load the heartbeat JS
function edd_heartbeat_enqueue( $hook_suffix ) {
// Make sure the JS part of the Heartbeat API is loaded.
wp_enqueue_script( 'heartbeat' );
@faiyazalam
faiyazalam / wpmu_migration_sql.txt
Last active December 4, 2017 07:03
How to update all the required tables while Migrating Wordpress Multisite - Single Network
//For Primary Blog
UPDATE `wp_options` SET `option_value`='http://www.test.com' WHERE `option_name`='siteurl';
UPDATE `wp_options` SET `option_value`='http://www.test.com' WHERE `option_name`='home';
//For Secondary Blog
UPDATE `wp_2_options` SET `option_value`='http://www.test.com/blog_2' WHERE `option_name`='siteurl';
UPDATE `wp_2_options` SET `option_value`='http://www.test.com/blog_2' WHERE `option_name`='home';
//Repeat the above codes for all the remaining blogs