Skip to content

Instantly share code, notes, and snippets.

View dingo-d's full-sized avatar
🏠
Working from home

Denis Žoljom dingo-d

🏠
Working from home
View GitHub Profile
@MindyPostoff
MindyPostoff / disable-paypal-woocommerce
Last active January 16, 2017 12:07
Disable PayPal in WooCommerce Checkout for Certain Products
/*
* Disable PayPal payment method in the checkout if certain
* products are present in the cart.
*
* Add this to your theme's functions.php file
*/
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways( $gateways ){
global $woocommerce;
@runcom
runcom / update-vagrant
Last active June 1, 2017 10:11
Shell script to upgrade your vagrant to the latest version
#!/bin/sh
ONLINE_VERSION=$(curl -s https://www.vagrantup.com/downloads.html) | grep -i 'x86_64.deb' | sed 's/.*\/vagrant_\(.*\)_x86_64\.deb.*/\1/i'
SYSTEM_VERSION=$(vagrant --version) | sed 's/^vagrant \(.*\)$/\1/i'
VAGRANT_CHECK=$(command -v vagrant >/dev/null 2>&1)
#if [ "$VAGRANT_CHECK" = 1 ]; then
#novagrant
#else
@benlk
benlk / 0-toc.md
Last active March 29, 2023 13:13
Collection of notes on WP_UnitTestCase
  1. Table of contents
  2. General information
    1. Terms
    2. General structure of a test
    3. WordPress-specific assertions and test functions
      • enqueues
      • creating posts
      • creating terms
      • attaching images
  • ?
@anderly
anderly / woocommerce-add-custom-product-data-tab.php
Last active June 8, 2023 20:30
WooCommerce - Add Custom Product Data Tab
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'my_text_domain' ),
'target' => 'my_custom_product_data',
);
return $product_data_tabs;
}
@lysender
lysender / using-aws-kms.php
Created November 10, 2015 09:13
Using AWS KMS API via PHP SDK
<?php
use Aws\Kms\KmsClient;
// Somewhere in the controller or model
$this->load->config('aws');
// Not needed for EC2 instance role based authorization - for my local instance only
$key = $this->config->item('aws_s3_access_key');
$secret = $this->config->item('aws_s3_secret_key');
@DomenicF
DomenicF / get_current_post_type.php
Last active December 5, 2022 07:11 — forked from bradvin/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type ) {
return $post->post_type;
@tmaiaroto
tmaiaroto / Dockerfile
Last active June 30, 2022 08:48
WordPress on Amazon ECS
FROM alpine:3.3
MAINTAINER Tom Maiaroto <tom@outdoorsy.co>
# Install packages
RUN apk --update --repository http://dl-3.alpinelinux.org/alpine/edge/main add \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev \
php7 \
@fsuste
fsuste / Gems.md
Last active November 24, 2021 13:06
List of problematic gems and fixes

Eventmachine 1.0.8.

You can also update eventmachine to 1.0.9. and that should fix the problem

gem install eventmachine -v '1.0.8' -- --with-cppflags=-I/usr/local/opt/openssl/include

Nokogiri 1.6.*

@renatomefi
renatomefi / README.md
Last active December 13, 2021 12:15
Milhog start script for Ubuntu 14.04

This is a simple way to install mailhog, might not be the best solution for everyone, you can look for repositories, still have to register the binary in the PATH, among other things, this is a manual simple install.

Binary download

Download mailhog from the releases page on github: https://github.com/mailhog/MailHog/releases Save the binary at /opt/mailhog/mailhog Give it executable permission chmod +x /opt/mailhog/mailhog

Init script

Download the gist: https://gist.github.com/renatomefi/d133fea9cb5a7b00f91edb24b83d9a31#file-init-d-mailhog-sh Put it at /etc/init.d/mailhog