Skip to content

Instantly share code, notes, and snippets.

View pje's full-sized avatar
:octocat:

Patrick Ellis pje

:octocat:
  • Brooklyn
  • 21:23 (UTC -04:00)
View GitHub Profile
@pje
pje / partial_object.rb
Created April 11, 2018 00:11
Mocha matcher to recursively match nested data structures
require 'mocha/parameter_matchers/base'
module Mocha
module ParameterMatchers
# @example
# partial = {
# a: [ 1, 2 ],
# b: {
# hello: {
# world: [ 'foo' ]
@pje
pje / 2017.md
Last active May 26, 2022 21:51
2017: an unordered list of my favorite albums of the year
@pje
pje / ack_tracks_js.scpt
Last active March 12, 2017 20:54
itunes script to rename selected tracks' artist, title, and number using an arbitrary shell command given the track name through stdin
var app = Application.currentApplication();
var itunes = new Application('iTunes');
var selection;
app.includeStandardAdditions = true;
itunes.includeStandardAdditions = true;
var artistNameDialog = {
text: "function for artist name? echo \"$track_name\" | $this_command",
default: "/usr/local/bin/ack '^(\\d+) (.*) *- *(.*)$' --output '$2'"
@pje
pje / keybase.md
Created September 28, 2016 15:33

Keybase proof

I hereby claim:

  • I am pje on github.
  • I am pje (https://keybase.io/pje) on keybase.
  • I have a public key whose fingerprint is 7FB1 9E38 88B0 6198 CE20 FDD3 B16F 572E 40D2 390A

To claim this, I am signing this object:

@pje
pje / star.js
Last active September 15, 2016 14:40
// import { filter, flatten, minBy, range, reject, zip } from 'lodash';
const filter = require('lodash').filter;
const flatten = require('lodash').flatten;
const minBy = require('lodash').minBy;
const range = require('lodash').range;
const reject = require('lodash').reject;
const zip = require('lodash').zip;
const complement = f => ((...args) => !(f(...args)));
@pje
pje / worst_words.txt
Last active August 28, 2018 16:17
a list of the worst words
wifey
hubby
webinar
methinks
ridonculous
@pje
pje / Makefile
Last active March 30, 2016 21:32
microrefinements to facilitate method chaining in ruby
test:
ruby *_spec.rb
.PHONY: test
@pje
pje / locus.txt
Created January 9, 2015 23:58
locus.txt (https://twitter.com/kg_ubu/status/551776106807066624 -> pdftk -> tesseract -> cat)
10 below
10 feet above the ground
10 feet beneath the ice
10 hours from home
10 miles away
10 miles southeast
10 more yards to the front
10 or 12 hot grueling miles
10—boats out right now
10000 BC
@pje
pje / style_snippet.html
Created November 17, 2013 14:13
Basekrville, #eeffdb
<html>
<head>
<style type="text/css">
body {
background-color: #eeffdb;
font-family: Baskerville, "URW Palladio L", "Palatino Linotype", serif;
font-size: 125%;
}
</style>
</head>
@pje
pje / replace_key.rb
Last active December 12, 2015 12:39
Extension for Ruby's Hash class: - `Hash#replace_key!` - `Hash#replace_key`
class Hash
def replace_key!(a, b)
if self[a]
self[b] = self.delete(a)
end
self
end
def replace_key(a, b)