Skip to content

Instantly share code, notes, and snippets.

View pritdeveloper's full-sized avatar
🏠
Working from home

Pritpal Singh pritdeveloper

🏠
Working from home
View GitHub Profile
@pritdeveloper
pritdeveloper / .gitignore
Created May 29, 2019 17:10
curl {RAW_URL} > ~
.hgignore
node_modules
.c9
.DS_Store
Thumbs.db
# C/C++
*.slo
*.lo
*.o
@pritdeveloper
pritdeveloper / mu-singh.php
Last active June 27, 2025 14:51
mu-plugin for wordpress
<?php
/**
* Plugin Name: MU Singh
* Description: This plugin is used to provide all helper functions and some other functionality for wordpress websites.
*/
/*
mkdir -p wp-content/mu-plugins/mu-singh && cd wp-content/mu-plugins/mu-singh && composer require digitalnature/php-ref filp/whoops && cd ../../../
*/

Startup steps for AWS Cloud9

These are the startup steps for AWS Cloud9. The Platform should be set to Ubuntu Server 18.04 LTS.

Git Config and global .gitignore file

  • Setup the git configuration variables
     git config --global user.name "Pritpal Singh"
     git config --global user.email "[email protected]"
     git config --global core.excludesfile "~/.gitignore"
     git config --global color.ui true
<VirtualHost *:80>
DocumentRoot /home/ubuntu/environment
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/ubuntu/environment>
Options Indexes FollowSymLinks
@pritdeveloper
pritdeveloper / reset root MySQL password.md
Last active June 18, 2024 06:03
reset root MySQL password

How to reset root MySQL password on Ubuntu

sudo mysql -u root
FLUSH PRIVILEGES;
USE mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.2
sudo a2dismod php5
sudo a2enmod php7.2
sudo apt-get install php7.2-dom php7.2-mbstring php7.2-zip php7.2-mysql php7.2-sqlite php7.2-curl php7.2-gd
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2dismod php5
sudo a2enmod php7.1
sudo apt-get install php7.1-dom php7.1-mbstring php7.1-zip php7.1-mysql php7.1-sqlite php7.1-curl php7.1-gd
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.0
sudo a2dismod php5
sudo a2enmod php7.0
sudo apt-get install php7.0-dom php7.0-mbstring php7.0-zip php7.0-mysql php7.0-sqlite php7.0-curl php7.0-gd
@pritdeveloper
pritdeveloper / wc_order_status_changes.php
Created August 3, 2018 14:56 — forked from abegit/wc_order_status_changes.php
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
// define plugin variables
define( 'PLUGIN_PATH', rtrim( plugin_dir_path( __FILE__ ), '/' ) );
define( 'PLUGIN_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );