Skip to content

Instantly share code, notes, and snippets.

@stephenharris
stephenharris / config.yml
Created December 15, 2019 20:56
Deploying an react app to s3 bucket / cloudfront.
version: 2
jobs:
build:
docker:
- image: circleci/node:10
steps:
- checkout
- run: npm install
- run: sudo apt-get update && sudo apt-get install -y python-dev
- run: sudo curl -O https://bootstrap.pypa.io/get-pip.py
@stephenharris
stephenharris / config.yml
Created December 15, 2019 20:51
Circle CI config for deploying with serverless
version: 2
jobs:
build:
docker:
- image: circleci/node:10
steps:
- checkout
# Download and cache dependencies
- restore_cache:
@stephenharris
stephenharris / currencyField.js
Last active July 17, 2018 21:45
Formats currency input and provides a method from extracting the amount (in fractional currency units - i.e. in cents/pennies) http://jsfiddle.net/7g26x0uL/155/
$.widget( "nmk.currencyField", {
// Default options.
options: {
decimalPlaces: 2,
decimalSeperator: ".",
thousandSeperator: ",",
},
_create: function() {
@stephenharris
stephenharris / import-venues.php
Created March 21, 2017 11:12
A WP-CLI command to import a CSV of venues
<?php
/*
Plugin Name: Import Venues WP CLI command
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: Adds `wp eo venue import <path-to-file>` command.
Author: Stephen Harris
Version: 0.1
*/
// Exit if accessed directly
@stephenharris
stephenharris / oauth-single-access-token.php
Created December 1, 2016 13:18
OAuth Single Access Token
<?php
/**
* Plugin Name: OAuth 1.0a Single Access Token
* Description: Create Single Access Tokens
* Version: 0.1.0
*
*/
/**
* Allows you to create a 'single access token' for each consumer.

Running Behat on VVV

TODO:

  • How to copy plugins into place
  1. Configure Behat.yml

    Here I've used the details for http://local.wordpress-trunk.dev/:

    • Database: wordpress_trunk
@stephenharris
stephenharris / install-firefox-linux.md
Last active April 2, 2023 09:44
Installing a particular version of firefox on Linux.

Installing a particular version of FireFox on Linux

  1. Does an existing version of firefox exist?

    firefox --version
    

    If not, skip to (3).

@stephenharris
stephenharris / flush-permalink.sh
Last active July 20, 2016 18:40
Can be used to flush the rewrite rules of all sites in a multisite network.
@stephenharris
stephenharris / rest-api.md
Last active July 5, 2016 19:37
Event Organiser Rest API - Draft specification

Event Organiser Rest API - Draft specification

Version: 0.3.0

Endpoints

The endpoints listed below assume a base of <yoursite>/wp-json/wp/v2


@stephenharris
stephenharris / wp-benchmark.php
Created April 19, 2016 10:23
Simple wp-cli based benchmark command
<?php
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {
return;
}
/**
* Implements example command.
*/
class Benchmark_Command extends WP_CLI_Command {