Skip to content

Instantly share code, notes, and snippets.


Jay Dorsey jaydorsey

Block or report user

Report or block jaydorsey

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
View pry_instance.rb
# This file lives in the pry gem. This patch strips out backtrace information from the gems, so I
# only see _my_ code files related to an error when I'm in a pry session
# Replace the content in the begin block inside the +show_result+ method
# @todo Make this a separate gem that I can install to patch this method without having to edit my
# bundled pry gem
relevant_context = e.backtrace.reject { |b| b =~ /(ruby\/gem)|(asdf\/installs)/ }
output.puts "(pry) output error: #{e.inspect}\n\nRelevant files:\n\n#{relevant_context.join("\n")}\n\n"
jaydorsey / Aptfile
Last active Oct 15, 2019
Notes on Poppler/ActiveStorage on Heroku
View Aptfile
jaydorsey / gist:6221c3e93f6ce114db772bcc3bdc628b
Created Aug 18, 2019
Generate rdoc documentation for local gems
View gist:6221c3e93f6ce114db772bcc3bdc628b
# Generates docs
gem list | awk '{ print $1 }' | xargs gem rdoc
# Starts server
gem server
View gist:3a5397c24955ec8788828eb364682448
"$schema": "",
"definitions": {
"attributes": {
"additionalProperties": false,
"description": "Members of the attributes object (\"attributes\") represent information about the resource object in which it's defined.",
"patternProperties": {
"^(?!relationships$|links$)\\w[\\w_-]*$": {
"description": "Attributes may contain any valid JSON value."
jaydorsey / bug_report.rb
Last active Jul 26, 2019
jsonapi-resources bug report
View bug_report.rb
require 'bundler/inline'
require 'bundler'
require 'pry'
require 'pry-byebug'
rescue LoadError => e
STDERR.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
jaydorsey / remove.js
Created Nov 19, 2018
Scummy facebook advertisers
View remove.js
// Automatically clicks the "Remove" button for all the advertisers
// that are showing from this page:
// under the "Advertisers who you've interacted with" (who I actually have never
// interacted with), "Who use a contact list added to facebook" (that they likely
// bought 2nd hand because I've never done business with them)
// Click the "More" button multiple times to display them all, then run this script
var buttons = document.querySelectorAll("[data-tooltip-content='Remove']");for (i = 0; i< buttons.length; i++) { buttons[i].click();};
jaydorsey / post-receive
Created Nov 2, 2018
Notify of file changed after git pull
View post-receive
#!/bin/sh -eu
# This file goes in .git/hooks/post-receive
if git diff-tree --name-status -t -r --root HEAD | grep -q 'development.sql'
echo "Your db/data/development.sql file changed. You may want to run rails gs:load"
jaydorsey / factory_doctor.rb
Last active Oct 17, 2018 — forked from palkan/factory_doctor.rb
FactoryDoc: detect useless data generation in tests
View factory_doctor.rb
module FactoryGirl
module Doctor
module FloatDuration
refine Float do
def duration
t = self
format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000)
jaydorsey /
Created Jul 12, 2018
Update all your local gems
# Don't run this unless you know why you're running this
gem outdated | awk '{print $1}' | xargs gem update $1
You can’t perform that action at this time.