Skip to content

Instantly share code, notes, and snippets.

View codenannu's full-sized avatar

Nand kishor Shukla codenannu

  • Sangam Vihar, Delhi
View GitHub Profile
@codenannu
codenannu / sql_without_fullmode.sql
Last active June 22, 2017 10:56
SET SQL to be used without fullmode only
#After login to mysql
## mysql -u <username> -p<password>
#Then execute following command:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
#@link: https://stackoverflow.com/a/36033983/773376
#@link: https://stackoverflow.com/questions/12932760/mysql-allow-invalid-dates-on-select/15960087
@codenannu
codenannu / json_encode_debug.php
Last active January 18, 2019 07:55
To Know Issue In json_encode in PHP
<?php
/**
* File to remind myself what things may come handy
* while I get stuck somewhere and don't have idea
* why things aren't working. These tricks may help you
* know the cause and solve the issue
**/
//Checklist 1: Sometimes, your json_encode may return null or false.
//So to know if there is some issue in json_encode itself, use this switch below
$a = json_encode($b); //or $a = json_encode($b, JSON_UNESCAPED_UNICOD);
@codenannu
codenannu / install_docker.sh
Last active January 18, 2019 08:19
How To Install and Use Docker on Ubuntu 16.04
## Install docker on ubuntu
# Refer link :
https://www.docker.com/products/docker-toolbox
# Refer GuidLines :
https://docs.docker.com/toolbox/toolbox_install_windows/
## Install docker on ubuntu
# Refer link
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
https://docs.docker.com/compose/install/#alternative-install-options
@codenannu
codenannu / corsslim_setup.sh
Last active January 18, 2019 08:16
PHP API Startup With Corsslim
## PHP API SETUP
# First step to install composer :
# (For Windows) :
https://getcomposer.org/Composer-Setup.exe
# (For Linux) :
1. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
2. php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
3. php composer-setup.php
# Second step to move the attach file where the php code running : (either xampp/wampp)
@codenannu
codenannu / woocommerce_dummy.sh
Last active January 18, 2019 08:22
Woocommerce With Wordpress
## How to import data
# Refer link :
https://docs.woocommerce.com/document/importing-woocommerce-dummy-data/
https://woocommerce.com/theme-demo-content/
## WooCommerce dummy data
# Refer link :
https://github.com/woocommerce/woocommerce/blob/master/dummy-data/dummy-data.xml
https://github.com/woocommerce/woocommerce/tree/master/dummy-data
@codenannu
codenannu / php_exception_handler.php
Last active January 18, 2019 08:26
Set up exception handler
<?php
/** set up exception handler to report what we didn't catch **/
function exception_handler($exception) {
if($exception instanceof MyException) {
echo "you didn't catch a myexception instance\n";
} else if($exception instanceof Exception) {
echo "you didn't catch a exception instance\n";
} else {
echo "uncaught exception of type: ".gettype($exception)."\n";
@codenannu
codenannu / wordpress_docker_compose.yml
Last active January 18, 2019 08:28
Wordpress Docker Composer
version: '2'
services:
wordpress:
image: wordpress:latest # https://hub.docker.com/_/wordpress/
ports:
- 127.0.0.1:85:80 # change ip if required
volumes:
- ./test:/var/www/html # Full wordpress project
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
#- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
@codenannu
codenannu / edit_docker_php_ini.php
Last active January 18, 2019 08:29
Increase max upload file size in docker php.ini
## Create uploads.ini then, content is
file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600
## use this solution, to replace uploads.ini
db:
image: mysql:latest
@codenannu
codenannu / installtion_file.sh
Last active June 29, 2017 11:15
Installtion Process npm, node, grunt, sass, bower On ubuntu
## Learn sass
# Refer link :
http://sass-lang.com/documentation/file.SASS_REFERENCE.html
## First we install npm and nodejs (npm + nodejs)
#refer link :
https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/#
## Second install grunt
#refer link :
@codenannu
codenannu / enable_java.sh
Created July 5, 2017 06:18
How do I enable Java in a web browser on Ubuntu Linux?
## Google Chrome
# Become the root user by running the su command and then enter the super-user password. Type:
sudo -s
# Create a directory called plugins if you do not have it. Type:
mkdir -p /opt/google/chrome/plugins
# Go to Google chrome plugins directory before you make the symbolic link. Type:
cd /opt/google/chrome/plugins
# Create a symbolic link. Type:
ln -s /usr/local/java/jre1.7.0/lib/amd64/libnpjp2.so
# Restart your browser and test Java