Skip to content

Instantly share code, notes, and snippets.

View 65's full-sized avatar

Duncan Isaksen-Loxton 65

View GitHub Profile
@ChromeOrange
ChromeOrange / gist:5770314
Last active July 3, 2017 01:18
Add a surcharge to the cart and checkout
/**
* Add a 1% surcharge to your cart / checkout
* change the $percentage to set the surcharge to a value to suit
* Uses the WooCommerce fees API
*
* Add to theme functions.php
*/
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
@Nikschavan
Nikschavan / modal.js
Last active September 25, 2018 22:37
Modal Element - Ultimate Addon's For Visual composer: Play YouTube video automatically when modal is opened.
<script>
$ModalvideoID = 'mV7KeHRu6os';
$width = '450';
$height = '283';
function modalAutoPlayVideo(vcode, width, height){
"use strict";
jQuery(".ult_modal-body.ult-youtube").html('<iframe width="'+width+'" height="'+height+'" src="https://www.youtube.com/embed/'+vcode+'?autoplay=1&loop=1&rel=0&wmode=transparent" frameborder="0" allowfullscreen wmode="Opaque"></iframe>');
}
@wturrell
wturrell / popular-posts.php
Created March 14, 2014 12:33
Wordpress & Google Analytics - retrieve most popular posts
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.