Skip to content

Instantly share code, notes, and snippets.

View strathmeyer's full-sized avatar

Eric Strathmeyer strathmeyer

View GitHub Profile
@strathmeyer
strathmeyer / prod.sh
Created September 14, 2017 06:02
Blames TODOs in Python files
GIT_GREP="$(git grep -i -n -E '#[ ]*TODO' -- '*.py')"
IFS=$'\n' read -rd '' -a LINES <<<"$GIT_GREP"
for LINE in "${LINES[@]}"
do
IFS=: read FILE LINE MATCH <<<"$LINE"
echo "$FILE:$LINE"
git blame $FILE -L $LINE,+1
echo
done
@strathmeyer
strathmeyer / rename_cbf.py
Last active August 29, 2015 13:57
Collects .cbf files from multiple subdirectories, copies them to a common output directory, modifies the filename of each and also modifies a line inside the file to match the new filename.
import glob
import os
import re
# Create the output directory if it doesn't exist
output_dir = './output/'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Pull in all the input file names. The "**"" means "this directory and any
@strathmeyer
strathmeyer / hapi_cache.js
Last active August 29, 2015 13:57
Demo hapi's caching of method results
var Hapi = require('hapi');
var server = new Hapi.Server('localhost', 8000);
var add = function (a, b, next) {
console.log("Calculating...");
next(null, a + b);
};
server.method('sum', add, { cache: { expiresIn: 2000 } });
@strathmeyer
strathmeyer / Gruntfile.js
Last active February 25, 2016 19:14
A simple Gruntfile
module.exports = function(grunt) {
grunt.initConfig({
concat: {
js: {
src: ['js/jquery-2.0.3.min.js',
'js/plugins/*.js',
'js/site.js'],
dest: 'build.js',
options: {
separator: ';'
require 'date'
def parse_whackness(date_string)
year = parse_year(date_string)
month, day = guess_day_month(date_string[0..-5])
Date.new(year.to_i, month.to_i, day.to_i)
end
@strathmeyer
strathmeyer / gist:5230028
Created March 24, 2013 01:22
Using the sitemap in Middleman
<% if current_page.parent %>
<h2>Parent</h2>
<ul>
<li><%= link_to current_page.parent.data.title, current_page.parent %></li>
</ul>
<% end %>
<h2>Children</h2>
<ul>
<% current_page.children.select { |p| p.ext == ".html" && p.data.title }.each do |resource| %>
@strathmeyer
strathmeyer / gist:4990173
Created February 19, 2013 21:31
Improve OSX Bluetooth quality
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 48
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 40
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 48
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 53
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 48
defaults write com.apple.BluetoothAudioAgent "Stream - Flush Ring on Packet Drop (editable)" 30
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 15
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" "0.75"
@strathmeyer
strathmeyer / gist:4433071
Last active December 10, 2015 12:18
Books I read in 2012
1. Poke the Box
2. Anything You Want
3. Snuff (Pratchett)
4. Republic, Lost
5. Guards! Guards!
6. Men At Arms
7. Buddy Does Seattle
8. Buddy Does Jersey
9. Feet of Clay
10. Jingo
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
@strathmeyer
strathmeyer / gist:3720224
Created September 14, 2012 06:37
'bower update' with a component.json
~/Development/footest ls
component.json
~/Development/footest cat component.json
{
"name": "footest",
"version": "0.0.1",
"main": [],
"dependencies": {
"jquery": "~1",
"underscore": "~1.3.3",