Skip to content

Instantly share code, notes, and snippets.

View ashokdhaduk's full-sized avatar
♻️
Full Stack Developer

Ashok ashokdhaduk

♻️
Full Stack Developer
View GitHub Profile
@ashokdhaduk
ashokdhaduk / iis-web.config
Created May 11, 2018 14:21 — forked from Toddses/iis-web.config
Example web.config for WordPress on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
@ashokdhaduk
ashokdhaduk / .htaccess
Created May 23, 2018 16:01 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ashokdhaduk
ashokdhaduk / install.sh
Created May 28, 2018 04:39 — forked from tanmay27vats/install.sh
Install pthreads (Multithreading) on Amazon AWS EC2 server having PHP version 5.6.x
#Install pthreads on AWS-EC2 with php5.6
#!/usr/bin/env bash
sudo yum update -y
sudo yum install httpd
cd
wget https://mirror.webtatic.com/yum/el6/latest.rpm
sudo yum install latest.rpm -y
sudo yum-config-manager --enable webtatic
sudo yum clean all
sudo yum install --enablerepo=webtatic php56w php56w-bcmath php56w-gd php56w-imap php56w-mbstring php56w-mcrypt php56w-mysqlnd php56w-pear php56w-xml php56w-soap php56w-devel -y
@ashokdhaduk
ashokdhaduk / replace_french_chars.php
Created May 28, 2018 04:40 — forked from tanmay27vats/replace_french_chars.php
Replace French orthography to Normal English. I used this to rename folder-name/file-names/slugs
function frenchChars($string)
{
$normalizeChars = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ń'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ń'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u',
@ashokdhaduk
ashokdhaduk / shopify-variant-filters.txt
Created May 28, 2018 04:40 — forked from tanmay27vats/shopify-variant-filters.txt
Showing Shopify product's variants (Size / Length / Color) as filters on collection page.
/*****
Here, I am assuming that you have already assigned all variants as tags of a product. Because Shopify filter does not work with variant options.
And, if you assigns all variants as tags you can not differentiate them from tags.
Here I code that is working for 2 filters Size & Length (with mulitple options. ie mulitple sizes, multiple lengths, etc
*****/
<div class="filters-toolbar">
<div class="filters-toolbar__item size-filter">
{% assign variant_sizes = "" %}
{% assign variant_lengths = "" %}
@ashokdhaduk
ashokdhaduk / yahoo_weather.php
Created May 28, 2018 04:40 — forked from tanmay27vats/yahoo_weather.php
Yahoo weather YQL API without authentication / No OAuth required - PHP script
<?php
class Yahoo_Weather
{
protected $base_url = "http://query.yahooapis.com/v1/public/yql";
protected $location = false;
protected $units = false;
protected $current = false;
protected $future = false;
protected $data = false;
@ashokdhaduk
ashokdhaduk / bash.sh
Created May 28, 2018 04:41 — forked from tanmay27vats/bash.sh
change editor for git
git config --global core.editor "vim"
#Run above command in Terminal / git-bash to change git editor from default to "vim" editor
@ashokdhaduk
ashokdhaduk / update.sql
Created May 28, 2018 04:41 — forked from tanmay27vats/update.sql
Renaming Custom Post Types and Taxonomies Through MySQL Query - Wordpress
SQL query for renaming the posts:
UPDATE `wp_posts` SET `post_type` = '<new post type name>' WHERE `post_type` = '<old post type name>';
SQL query for renaming taxonomy:
UPDATE `wp_term_taxonomy` SET `taxonomy` = '<new taxonomy name>' WHERE `taxonomy` = '<old taxonomy name>';
# That should take care of all of the database areas. Just remember to match the new names in the code where the post types or taxonomies are registered. As far as I know, this is not handled in any plugins yet.
@ashokdhaduk
ashokdhaduk / ios_push_notification.php
Created May 28, 2018 04:41 — forked from tanmay27vats/ios_push_notification.php
Apple Push Notification service (APNs) - iOS Push Notification in PHP
<?php
// Provide the Host Information.
$vHost = 'gateway.sandbox.push.apple.com';
//$vHost = 'gateway.push.apple.com';
$vPort = 2195;
// Provide the Certificate and Key Data.
$vCert = 'Certificates.pem';
@ashokdhaduk
ashokdhaduk / script.js
Created May 28, 2018 04:42 — forked from tanmay27vats/script.js
Custom Add to cart WooCommerce, Refresh fragments data, Refresh cart total items, Get product variation
product_add_to_cart : function(){
var ajx_data = {};
var ajx_grab = {};
$(document).on('change','.single-product .variations_form select',function(e){
var $this = $(this);
var pro_id = $(".single-product .variations_form").attr('data-product_id');
var attribute_name = $this.attr('data-attribute_name');
var attribute_value = $this.val();
var post_ajxurl = window.location+"?wc-ajax=get_variation";