Skip to content

Instantly share code, notes, and snippets.

View mcmire's full-sized avatar
🎯
Not a lot of time for side projects these days, so ping me if I'm unresponsive!

Elliot Winkler mcmire

🎯
Not a lot of time for side projects these days, so ping me if I'm unresponsive!
View GitHub Profile
@mcmire
mcmire / 00_README.md
Last active October 31, 2022 01:17
Installation and uninstallation scripts for dotfiles

This gist provides scripts that you can use to install files inside of a dotfiles repo into your home directory and uninstall them if you wish. To use these, download the zip file of this gist and unzip it into the bin folder of your dotfiles repo. Then run chmod +x bin/install bin/uninstall. After this, run:

bin/install --help
bin/uninstall --help
@mcmire
mcmire / bypass_broken_images_middleware.rb
Last active October 16, 2021 11:09
Ignore requests for broken images in Capybara tests
# Instructions
# ------------
#
# * Save this as app/middlewares/bypass_broken_images_middleware.rb
# * Add the following inside of the Rails.application.configure block
# in config/environments/test.rb:
#
# config.middleware.insert_before(
#  ActionDispatch::DebugExceptions,
#  BypassBrokenImagesMiddleware,
@mcmire
mcmire / ppl.rb
Created January 2, 2011 05:33
Writing `pp` output to a Rails log
require 'pp'
module Kernel
class LoggerAppender
include Singleton
def <<(msg)
RAILS_DEFAULT_LOGGER.send(:buffer) << (msg || "")
RAILS_DEFAULT_LOGGER.send(:auto_flush)
msg
end
end
@mcmire
mcmire / .rubocop.yml
Last active April 16, 2021 03:23
My Rubocop settings
---
AllCops:
Exclude:
- db/schema.rb
TargetRubyVersion: 3.0
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/ClassStructure:
Enabled: true
Layout/DotPosition:
@mcmire
mcmire / tmux.conf
Created April 2, 2021 20:42
Nested tmux sessions
### Nested sessions (YO DAWG)
# Source: <https://www.freecodecamp.org/news/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795/>
# TODO - remove
color_status_text="colour245"
color_window_off_status_bg="colour238"
color_light="white" #colour015
color_dark="colour232" # black= colour232
color_window_off_status_current_bg="colour254"
@mcmire
mcmire / keybase.md
Created October 30, 2020 21:10
keybase.md

Keybase proof

I hereby claim:

  • I am mcmire on github.
  • I am mcmire (https://keybase.io/mcmire) on keybase.
  • I have a public key ASC7iNozmJJj7k2-uykoJm9ewCoCxX2z4PmeX7wpjbZeygo

To claim this, I am signing this object:

@mcmire
mcmire / super_diff_81.md
Last active May 15, 2020 04:34
super_diff #81

Let's say you have this test:

expected = {
  created_at: "Tue Jan 13 19:28:24 +0000 2009",
  favourites_count: 38,
  geo_enabled: false,
  verified: true,
  media_count: 51_044,
  statuses_count: 273_860,
@mcmire
mcmire / active_record_persistence_instrumenter.rb
Created October 23, 2019 02:09
Produces a tree of ActiveRecord + Fabrication calls
# This file allows to you to debug use of fabricators in tests by producing a hierarchical tree of
# objects created via ActiveRecord and Fabrication.
#
# Place this at spec/support/active_record_persistence_instrumenter.rb.
#
module PersistenceInstrumenter
class Tree
def initialize
@stack = []
@children = []
@mcmire
mcmire / graphql.md
Last active August 29, 2019 19:49
Guide to GraphQL

A Guide to GraphQL

We use GraphQL to implement APIs across our tech stack, particularly as a protocol for communication between a backend app and frontend app.

[REST][rest] is a mainstay in the API world; its concepts are more or less integrated into Rails, Django, Symfony, and other modern web frameworks. But GraphQL, which was developed and released by Facebook in 2015, offers a fundamentally different approach.

@mcmire
mcmire / 00_README.md
Last active July 11, 2019 04:44
validate_not_nil matcher (sketch)

You can use this matcher like so:

RSpec.describe User, type: :model do
  it { is_expected.to validate_not_nil(:favorite_numbers) }
end