Skip to content

Instantly share code, notes, and snippets.

@emgk
emgk / Vagrantfile.rb
Created June 23, 2020 12:34 — forked from mariusvetrici/Vagrantfile.rb
Vagrant file with NFS sharing - x100 times faster
# -*- mode: ruby -*-
# vi: set ft=ruby :
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure("2") do |config|
# Store the current version of Vagrant for use in conditionals when dealing
# with possible backward compatible issues.
vagrant_version = Vagrant::VERSION.sub(/^v/, '')
@emgk
emgk / instructions.md
Created September 15, 2018 17:07 — forked from sveggiani/instructions.md
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@emgk
emgk / block-fields.json
Created August 16, 2018 16:35
sample field json for "Guten block fields" npm package https://www.npmjs.com/package/guten-block-fields
{
"name": "My Controllers",
"output": "./blocks",
"toggles": {
"bio": {
"title": "Bio data",
"isOpen": true,
"icon": ""
},
"occuption": {
@emgk
emgk / <your-command>.cmd
Created August 3, 2018 16:17
Steps to set an alias for the windows existing command or new one.
@echo off
// Write your list of commands here which suppose to be executed when run "your-command" in command promt.
cd "Long-path"
@emgk
emgk / wp-config.php
Created December 11, 2017 06:57
WP Debug Configurations
define('WP_DEBUG', true);
define('SCRIPT_DEBUG',true);
if ( WP_DEBUG ) {
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'log_errors', 'On' );
@ini_set( 'display_errors', 'Off' );
@ini_set( 'error_reporting', E_ALL );
@ini_set( 'error_log', 'php_error.log' );
@emgk
emgk / setup-phpunit.sh
Created November 13, 2017 11:30 — forked from keesiemeijer/setup-phpunit.sh
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, git, subversion, composer, curl and wget
#
# The $WP_CORE_DIR and $WP_TESTS_DIR environment variables are added to the ~/.bashrc file
#
@emgk
emgk / pre-commit
Last active June 5, 2018 12:22
Local phpcs pre-commit script
#!/bin/bash
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# parse config
CONFIG_FILE=$(dirname $0)/config
if [ -e $CONFIG_FILE ]; then
. $CONFIG_FILE
@emgk
emgk / Instruction.txt
Created May 9, 2017 11:52
Docker deployment batch script
1. Put this file anywhere you want.
2. Copy the path where you saved this file
3. Set that path to environment setting of computer.
@emgk
emgk / docker-compose.yml
Created May 8, 2017 09:56
install the wordpress using docker
wordpress:
image: wordpress
links:
- mariadb:mysql
environment:
- WORDPRESS_DB_PASSWORD=<your password>
ports:
- "<Public IP>:80:80"
volumes:
- ./code:/code
@emgk
emgk / plugintemplate.php
Last active December 30, 2016 11:04
Templating Wordpress plugin like woocommerce
<?php
/**
* Plugin Name: Templating wp plugin like woocommerce
* Author: Govind Kumar
* Author URI: emgk.github.io
*
* Description -
* If you want to create template structure for your plugin,
* that any developer or theme can overide it, Then use this script.