This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_add_checkout_fee_for_gateway' ); | |
function bbloomer_add_checkout_fee_for_gateway() { | |
$chosen_gateway = WC()->session->get( 'chosen_payment_method' ); | |
if ( $chosen_gateway == 'hoolah_checkout' ) { | |
global $woocommerce; | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_cart_calculate_fees','endo_handling_fee' ); | |
function endo_handling_fee() { | |
global $woocommerce; | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
$subtotal = $woocommerce->cart->subtotal; | |
$fee_percentage = 0.1; // 10 percent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Payment Gateway Selection | |
add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_add_checkout_fee_for_gateway' ); | |
function bbloomer_add_checkout_fee_for_gateway() { | |
$chosen_gateway = WC()->session->get( 'chosen_payment_method' ); | |
if ( $chosen_gateway == 'paypal' ) { | |
WC()->cart->add_fee( 'PayPal Fee', 5 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Filters both variations and simple products with the same function | |
add_filter( 'woocommerce_product_variation_get_weight', 'filter_product_weight', 10, 2 ); | |
add_filter( 'woocommerce_product_get_weight', 'filter_product_weight', 10, 2 ); | |
/** | |
* @param float $weight | |
* @param WC_Product $product | |
* | |
* @return int | |
*/ | |
function filter_product_weight( $weight, $product ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET endpoint/user/:userid | |
GET endpoint/user/name | |
GET endpoint/user/category | |
GET endpoint/user/address | |
GET endpoint/user/purchase | |
GET endpoint/user/payment | |
GET endpoint/user/favorite | |
GET endpoint/user/cart | |
GET endpoint/user/scrap | |
---------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# please refer to https://github.com/nawawi/nginx-cache-data/blob/master/nginx-proxy-cache-data.sh | |
cat /tmp/nginx-proxy-cache-data/data-file-cache.txt |grep -v ^# |tr -s '|' ' ' |while read _host _size _url; do | |
_purge="$(echo $_url|sed -e "s/$_host/${_host}\/purge/g")"; | |
_output="$(curl -s -H "Host: ${_host}" ${_purge}*)"; | |
echo $_output; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// just an example. A cleaner way is to wrap the showLine-stuff in a dedicated component | |
<template> | |
<div> | |
<my-line v-if="showLine" :data="lineData" :options="options"> | |
</div> | |
</template> | |
<script> | |
export default { | |
data () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2018-07-11T08:10:09.420Z","extensionVersion":"v2.9.2"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int result[4][8] = {0}; | |
int i, j, PT, GP, W, GF, GA, GD, k, team; | |
char res, m; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Extracting first page of http://www.mudah.my/malaysia/cars-for-sale | |
from scrapy.spiders import CrawlSpider, Rule | |
from scrapy.linkextractors import LinkExtractor | |
from scrapy.selector import Selector | |
from items import NewsItem | |
filename = "output.csv" | |
fields = ["headline", "price", "url"] # define fields to use | |
with open(filename,'a+') as f: # handle the source file |
NewerOlder