Skip to content

Instantly share code, notes, and snippets.

Greg Boone gboone

Block or report user

Report or block gboone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gboone / feed-wordpress.xml
Last active Feb 21, 2019
A simple jekyll template to generate WordPress eXtended RSS (WRX) feeds suitable for importing into a WordPress site
View feed-wordpress.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
gboone /
Last active Jun 25, 2018
How to find intermediate images in a list of files
gboone / midpoint
Created Nov 28, 2015
How to find a geographic midpoint in js
View midpoint
function setLatLng(dataset) {
var lat =
var lng = dataset.lng
return new L.LatLng(lat, lng)
function latLngRadians(dataset) {
return, function(item) {
var latRad =*(Math.PI/180)
var lngRad = item.lng*(Math.PI/180)
gboone / wp_metadata_filter.rb
Created Sep 2, 2017
A jekyll filter to sort out and return only the wp:post_meta keys and values
View wp_metadata_filter.rb
module Jekyll
module WPmetadata
def wpmeta(input)
standard_post = [
gboone / commit-msg
Last active May 11, 2017
Copy Federalist preview URL on commit
View commit-msg
# A commit-msg hook to copy the federalist preview url to your clipboard after you commit.
# Note: The URL will not work until the preview site has actually generated, that doesn't happen until you `push`
NAME=$(git branch | grep '*' | sed 's/* //')
echo "Your federalist preview will be at$NAME/"
echo "$NAME/" | pbcopy
echo "This url has been copied to your clipboard."
gboone /
Last active Jan 11, 2017
Thanksgiving OOO

Hey there, I'm out of office for the Thanksgiving holiday. While you wait for me to get back to you, check out these ten awesome initiatives from my colleagues across the federal government:

  1. The General Services Administration's Fine Arts program has a trove of public art. Search the database and find some art near you!
  2. Speaking of art, the Bureau of Reclamation commissioned dozens of works of art in the 1960s. Check out the works they commissioned on their website.
  3. The National Ice Core Lab in Lakewood, CO contains samples of ice from deep in the earth's surface. It's pretty much the closest thing we have to time travel.
  4. Help your relatives stay safe if their identity is stolen on the Federal Trade Commission's [](
gboone / til.rb
Created Jan 20, 2016
Today I Learned about ruby logic
View til.rb
# this:
if expected['value']
variable = expected['value']
variable = "default"
# is the same as this:
unless variable = expected['value']
variable = "default"
View strip-doc-to-frontmatter.rb
# Strips the body out of a document. Quick and dirty, assumes ARGV is a real directory with markdown or YAML files in it.
# I hard coded the directory and am not really a rubyist so there's a chance I screwed up this ARGV thing.
#!/usr/bin/env ruby
require 'yaml'
files = Dir.glob("#{ARGV[0]}/*")
for file in files
yaml = YAML.load(, 'w') { |f|
f.write(yaml.to_yaml + "---")
gboone / maybe_flush.php
Last active Dec 21, 2015
Tired of hitting the Save Permalinks button every time you register a post type in WordPress? Try this function: it grabs the cached rewrite rules, checks for a target (could be anything, but let's say it's a post type with an archive) and flushes the rules if the rewrite rule isn't present.
View maybe_flush.php
function maybe_flush_rewrite_rules($target) {
$rules = get_option( 'rewrite_rules' );
if ( $rules[ $target . '/?$' ] != 'index.php?post_type=' . $target ) {
flush_rewrite_rules( $hard = true );
gboone / gist:4f4dee1290278b483e24
Created Jun 8, 2015
Turn "authors" attached to blog posts into a _data file
View gist:4f4dee1290278b483e24
#! /usr/bin/ruby
require 'jekyll'
config = Jekyll.configuration
source = config['source']
data_source = File.join(source, config['data_source'])
posts = File.join(source, '_posts')
authors = []
if ARGV[0].nil?
puts "No value passed for filename, assuming 'author.'"
file_name = 'author'
You can’t perform that action at this time.