Skip to content

Instantly share code, notes, and snippets.

@pbowyer
pbowyer / php_oboe functions
Created April 26, 2016 16:48 — forked from rsalmond/php_oboe functions
AppNeta php_oboe function signatures
<?php
/**
* Oboe API for PHP
*
* This can be used for autocompletion in many major PHP editors
* provides documentation for the code
* and can be used on systems where the oboe extension is not loaded
* to provide no-op versions of functionality
*/
<?php
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
if ( !$element )
return;
$id_field = $this->db_fields['id'];
@pbowyer
pbowyer / configure-mailgun
Created October 7, 2016 08:02 — forked from jgeewax/configure-mailgun
Script to configure Postfix for Mailgun
#!/bin/bash
# Configuration for the script
POSTFIX_CONFIG=/etc/postfix/main.cf
POSTFIX_SASL=/etc/postfix/sasl_passwd
function confirm () {
read -r -p "${1:-Are you sure? [Y/n]} " response
if [[ $response == "" || $response == "y" || $response == "Y" ]]; then
echo 0;
@pbowyer
pbowyer / README.md
Created January 25, 2018 11:06
BuzzFeed's README Template

name of the service

An explanation of what the service is doing and why. Any high level business logic should be mentioned here to give the reader an understanding of why the service exists in the first place.

List important endpoints/URLs and explain what they are responsible for.

Point of contact and Slack channel

@pbowyer
pbowyer / umap_sparse.py
Created August 22, 2018 10:59 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@pbowyer
pbowyer / criteria-to-query-builder.php
Created August 23, 2018 07:48 — forked from jgornick/criteria-to-query-builder.php
Doctrine: Criteria Array to Doctrine QueryBuilder
<?php
/**
* Recursively takes the specified criteria and adds too the expression.
*
* The criteria is defined in an array notation where each item in the list
* represents a comparison <fieldName, operator, value>. The operator maps to
* comparison methods located in ExpressionBuilder. The key in the array can
* be used to identify grouping of comparisons.
*
@pbowyer
pbowyer / Mailhog Bash Script (systemd)
Created January 17, 2020 10:57 — forked from v-jacob/Mailhog Bash Script (systemd)
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog