Skip to content

Instantly share code, notes, and snippets.

@stephenharris
stephenharris / bbpress-kses.php
Last active February 3, 2020 08:44
By default bbpress can be quite strict on the HTML it allows in posts (tags are whitelisted). The following loosens those restrictions and is taken from this post: http://buddypress.org/support/topic/tutorial-allow-more-html-tags-in-bp-forum-topics/
<?php
function myprefix_kses_allowed_tags($input){
return array_merge( $input, array(
// paragraphs
'p' => array(
'style' => array()
),
'span' => array(
'style' => array()
),
@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() {
<?php
/**
* This is a basic example of implementing front end creation of events with Event Organiser
* @see http://www.stephenharris.info/2012/front-end-event-posting/
* @see http://wordpress.org/extend/plugins/event-organiser/
*
*/
add_shortcode('my_event_form','my_event_form_shortcode_handler');
function my_event_form_shortcode_handler( ){
@stephenharris
stephenharris / print-selected.sh
Created April 4, 2015 10:03
Print selected files form the right-click context menu in Nautilus
#!/bin/bash
#
# print-selected.sh
#
# Print files from the right-click context menu in Nautilus.
# Place this script in ~/.local/share/nautilus/scripts & make executable.
#
# @see http://askubuntu.com/questions/319948/printing-multiple-files-from-nautilus
# @see http://www.frenssen.be/content/printing-file-right-click-context-menu-nautilus
for i in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
@stephenharris
stephenharris / git-alias.md
Last active December 16, 2016 11:52
An in-progress collection of useful git 'shortcuts' (alias)

.gitconfig

[alias]
        # A simplified graph of branches**
        branchtree = log --oneline --decorate --all --graph --simplify-by-decoration
        
        # Search commit messages

logsearch = !sh -c 'git log -i --all --grep=$1' -

@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 / 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.