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
gboone / intermediates.sh
Last active Jun 25, 2018
How to find intermediate images in a list of files
View intermediates.sh
^.*(\d*x\d*).(jpg|jpeg|png)
@gboone
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 = [
"output",
"content",
"relative_path",
"path",
"url",
"collection",
@gboone
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
gboone / commit-msg
Last active May 11, 2017
Copy Federalist preview URL on commit
View commit-msg
#!/bin/sh
#
# 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 https://federalist.18f.gov/preview/18F/18f.gsa.gov/$NAME/"
echo "https://federalist.fr.cloud.gov/preview/18F/18f.gsa.gov/$NAME/" | pbcopy
echo "This url has been copied to your clipboard."
@gboone
gboone / ooo.md
Last active Jan 11, 2017
Thanksgiving OOO
View ooo.md

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 [IdentityTheft.gov](https://identitytheft.gov
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(File.read(file))
File.open(file, 'w') { |f|
f.write(yaml.to_yaml + "---")
}
@gboone
gboone / til.rb
Created Jan 20, 2016
Today I Learned about ruby logic
View til.rb
# this:
if expected['value']
variable = expected['value']
else
variable = "default"
end
# is the same as this:
unless variable = expected['value']
variable = "default"
@gboone
gboone / midpoint
Created Nov 28, 2015
How to find a geographic midpoint in js
View midpoint
function setLatLng(dataset) {
var lat = dataset.lat
var lng = dataset.lng
return new L.LatLng(lat, lng)
}
function latLngRadians(dataset) {
return _.map(dataset, function(item) {
var latRad = item.lat*(Math.PI/180)
var lngRad = item.lng*(Math.PI/180)
@gboone
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'
@gboone
gboone / draft-format
Created May 11, 2015
18F Blog Draft format
View draft-format
## Audience:
## Goal of the Post:
## Imagery ideas:
## Description:
## Who needs to clear?
You can’t perform that action at this time.