Skip to content

Instantly share code, notes, and snippets.

View nathanielks's full-sized avatar

Nathaniel nathanielks

View GitHub Profile
// So, I'm debating whether user_role should be defined as primary_user_role,
// and changed from maj_student to something like journal_host|journal_guest?
// that would mess up though what links are displayed in the navigation
// though... but that's inconsequential. there are other ways of determining
// how those would be selected/displayed.
// my journals
// if not a teacher, display this
// family/friends
// get_users and filter by family/friend role
// teachers
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'somesite.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('MAJ_DEV', true);
@nathanielks
nathanielks / deploy.sh
Created January 23, 2014 18:47
Borrowed from https://github.com/thenbrent/multisite-user-management/blob/master/deploy.sh. Used for shipping to WordPress' plugin repository
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
# main config
PLUGINSLUG="multisite-user-management"
CURRENTDIR=`pwd`
MAINFILE="ms-user-management.php" # this should be the name of your main php file in the wordpress plugin
# git config
@nathanielks
nathanielks / get_template.php
Last active February 22, 2022 08:49
A set of functions for finding and getting a template and being able to pass parameters to it via an array. Borrowed from https://github.com/woothemes/woocommerce/blob/e3cc5931bad28b24233fb9d14c61c096cbd4b122/includes/wc-core-functions.php#L91
<?php
/**
* Get other templates (e.g. product attributes) passing attributes and including the file.
*
* @access public
* @param mixed $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void */
@nathanielks
nathanielks / WP_Admin_Notice.php
Last active July 17, 2019 17:33
Simple method to add a notice to the WP Admin
<?php
class WP_Admin_Notice {
public $class = '';
public $message = '';
function __construct( $message, $class = 'updated' ){
$this->class = $class;
$this->message = $message;
add_action( 'admin_notices', array( $this, 'output' ) );
<?php
/*
* Plugin Name: wpMandrill MS
* Plugin URI: trepmal.com
* Description: Network-wide settings for wpMandrill.
* Version: 2013.04.01
* Author: Kailey Lampert
* Author URI: kaileylampert.com
* License: GPLv2 or later
* TextDomain: wpmandrill-ms
@nathanielks
nathanielks / webhooks.php
Last active March 14, 2023 23:39
Script used to redirect webhook request from localhost to a local domain
<?php
// Props to goddva: http://stackoverflow.com/questions/1361169/possible-to-add-data-to-the-body-of-a-http-request-using-curl-in-php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://site.dev/webhooks.php?type=stripe");
curl_setopt($ch, CURLOPT_USERAGENT, "My user agent");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
@nathanielks
nathanielks / Vagrantfile
Created September 26, 2014 21:22
Improved bedrock-ansible Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version '>= 1.5.1'
Vagrant.configure('2') do |config|
config.vm.box = 'roots/bedrock'
# Required for NFS to work, pick any local IP
config.vm.network :private_network, ip: '192.168.50.5'

Keybase proof

I hereby claim:

  • I am nathanielks on github.
  • I am nathanielks (https://keybase.io/nathanielks) on keybase.
  • I have a public key whose fingerprint is E5F6 FFB4 3651 D39A 25B9 1DAD FE02 07A3 8BD5 4DC4

To claim this, I am signing this object:

@nathanielks
nathanielks / README.md
Last active June 3, 2023 17:24
Simple wrapper around terraform to manage multiple environments

This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:

main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf