Skip to content

Instantly share code, notes, and snippets.

View nathanielks's full-sized avatar

Nathaniel nathanielks

View GitHub Profile
* Plugin Name: wpMandrill MS
* Plugin URI:
* Description: Network-wide settings for wpMandrill.
* Version: 2013.04.01
* Author: Kailey Lampert
* Author URI:
* License: GPLv2 or later
* TextDomain: wpmandrill-ms
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| = 'roots/bedrock'
# Required for NFS to work, pick any local IP :private_network, ip: ''

Keybase proof

I hereby claim:

  • I am nathanielks on github.
  • I am 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 / wordpress.php
Created February 1, 2012 19:58 — forked from cogentParadigm/wordpress.php
Automated Wordpress Installer
$usage = "Automated Wordpress installer\nby Ali Gangji\nUsage: wordpress install_dir -u dbuser -p dbpass -d dbname\nOptions:\n";
$usage .= " -u dbuser Database username\n";
$usage .= " -p dbpass Database password\n";
$usage .= " -d dbname Database name\n";
$usage .= " -h dbhost Database host\n";
$usage .= " --private Hide blog from search engines\n";
$usage .= " --prefix prefix Database prefix\n";
if ($argc < 2) {
nathanielks / functions.php
Created March 14, 2012 21:25 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
nathanielks / leaflet-init.js
Created July 27, 2012 00:38
Leaflet Focus Overlay
var center = new L.LatLng(-18.9717, -3.53815); // geographical point (longitude and latitude)
var map = new L.Map('map', {
scrollWheelZoom: false,
}).setView(center, 3);
var watercolor = new L.StamenTileLayer("watercolor").addTo(map);
var overlayUrl = '/path/to/image.png',
nathanielks / Readme
Created September 7, 2012 04:46
jQuery Element Inline Distributor
I wrote this so that I could evenly distribute elements in a line. Here's an example that may explain better than words:, What it does it take the parent element and scans it for specific child elements. It then calculates the various widths and adds a left margin accordingly. The reason each element is given a display: block and float:left is because of a weird bug with display: inline. The script requires the elements to displayed inline initially, but because inline elements have a few extra pixels around them, the elements aren't all contained, even though the math is right. Really weird. Anyway, here's how you use it.
Here's the demo:
nathanielks / calc.js
Created November 27, 2015 02:50
Super simple way to calculate how long an course is
var seconds = 0;
$('.table.table-condensed .info-line small.duration').each(function(){
var s = this.innerText.split(':');
seconds += s[0] * 60;
seconds += s[1] * 1;
nathanielks / WooCommerce Sale Products up front
Last active December 11, 2015 12:38
This will force WooCommerce sale items to the front of the store listing, prices lowest to highest, then sorted by title A-Z.
* Sale Products Up Front
add_action( 'woocommerce_product_query', 'cur_sale_products_up_front', 10, 2);
add_filter('posts_request', 'cur_modify_products_query', 10, 2);
add_filter('loop_start', 'cur_reorder_sale_items');
//Utility function
function cur_replace_text($startPoint, $endPoint, $newText, $source) {
nathanielks / add-to-sidebar.php
Created April 26, 2013 18:22
These functions will programmatically add widgets to a specified sidebar. This can be useful when a theme is first installed to fill specific sidebars with widgets you're written for your theme. $add_to_sidebar takes the id of the sidebar you wish to add to. $widgets takes the id's of the widgets you wish to add.
function cur_add_widget_to_sidebar( $widget_name, $add_to_sidebar, &$sidebar_options ){
$widget = get_option('widget_'.$widget_name);
if(!is_array($widget))$widget = array();
$count = count($widget)+1;
$sidebar_options[$add_to_sidebar][] = $widget_name.'-'.$count;
$widget[$count] = array();