Skip to content

Instantly share code, notes, and snippets.

View prionkor's full-sized avatar

Sisir prionkor

View GitHub Profile
add_action( 'woocommerce_cart_calculate_fees', 'prionkor_cod_fee' );
function prionkor_cod_fee() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
// get your payment method
$fee = 10;
$chosen_gateway = WC()->session->chosen_payment_method;
@prionkor
prionkor / GMB Types
Created December 6, 2020 08:09
Google my business types
Abbey
Aboriginal and Torres Strait Islander Organisation
Aboriginal Art Gallery
Abortion Clinic
Abrasives Supplier
Abundant Life Church
Accountant
Accounting Firm
Accounting School
Accounting Software Company
@prionkor
prionkor / createHashSource.js
Created August 9, 2020 11:08
Hash Source for reach/router
"use strict";
const getHashPath = () => {
const href = window.location.href;
const hashIndex = href.indexOf('#');
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
};
const pushHashPath = path => window.location.hash = path;
const replaceHashPath = path => {
@prionkor
prionkor / countries-with-dial-code.js
Last active May 18, 2020 10:09 — forked from electerious/countries.js
All country codes in one object.
const countries = [
{ code: 'AD', label: 'Andorra', phone: '376' },
{ code: 'AE', label: 'United Arab Emirates', phone: '971' },
{ code: 'AF', label: 'Afghanistan', phone: '93' },
{ code: 'AG', label: 'Antigua and Barbuda', phone: '1-268' },
{ code: 'AI', label: 'Anguilla', phone: '1-264' },
{ code: 'AL', label: 'Albania', phone: '355' },
{ code: 'AM', label: 'Armenia', phone: '374' },
{ code: 'AO', label: 'Angola', phone: '244' },
{ code: 'AQ', label: 'Antarctica', phone: '672' },
@prionkor
prionkor / gmb-types.txt
Last active November 11, 2023 17:50
Google My Business Types
Local Business
Animal Shelter
Automotive
Automotive Business
Auto Body Shop
Auto Dealer
Auto Parts Store
Auto Rental
Auto Repair
Auto Wash
@prionkor
prionkor / clean-php-session-file.sh
Created March 31, 2019 17:37
PHP Session File Garbage Collection Bash Script
#!/bin/bash
# Export bin paths
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Get PHP Session Details
PHPSESSIONPATH=$(php -i 2>/dev/null | grep -w session.save_path | awk '{print $3}' | head -1);
PHPSESSIONLIFETIME=$(php -i 2>/dev/null | grep -w session.gc_maxlifetime | awk '{print $3}' | head -1);
PHPSESSIONLIFETIMEMINUTE=$( expr $PHPSESSIONLIFETIME / 60 );
@prionkor
prionkor / nginx_host.sh
Last active September 23, 2022 13:00
Ubuntu - Nginx - PHP 7.4 - New Domain Script
#!/bin/bash
# Info
# ---
# script can run with the domain as a command line input
# `sudo ./nginx_domain.sh my_domain.com` or without and
# the script will prompt the user for input
#config
web_root='/var/www'
config_dir='/etc/nginx'
@prionkor
prionkor / tracker.txt
Created May 20, 2017 19:08
A list of Torrent Trackers
Try this short list of super fast trackers first:
udp://tracker.openbittorrent.com:80
udp://tracker.leechers-paradise.org:6969
udp://tracker.coppersurfer.tk:6969
udp://glotorrents.pw:6969
udp://tracker.opentrackr.org:1337
http://tracker2.istole.it:60500/announce
Here is a longer list updated July 2016.
# gets error
let listItems = course.acf.videos.map(function(video){
return <li key={video.ID}>
<Link
to="/test"
activeClassName="active"
>video.post_title</Link>
</li>;
});
<?php
add_filter("mce_buttons", "tinymce_editor_buttons", 99); //targets the first line
add_filter("mce_buttons_2", "tinymce_editor_buttons2", 99); //targets the first line
function tinymce_editor_buttons() {
return array(
"bold",
"italic",
"strikethrough",