Skip to content

Instantly share code, notes, and snippets.

View MatthewRDodds's full-sized avatar

Matthew Russell Dodds MatthewRDodds

View GitHub Profile
@MatthewRDodds
MatthewRDodds / file.rb
Created December 18, 2019 15:24
Markdown Table Generator Script
#
# Usage:
#
# rows = [['User ID', 'Email'], ['1', 'example@email.com'],[2,'someone@email.com']]
# MarkdownTableGenerator.generate(rows)
#
module MarkdownTableGenerator
extend self
PIPE = '|'.freeze
@MatthewRDodds
MatthewRDodds / file.rb
Last active July 27, 2019 21:46
valve_calculator.rb
require 'json'
require 'pry'
class ValveLifterPositionCalculator
LIFTER_MEASUREMENT_FOR_GAP_MEASURE = 0.2090
LIFTERS = [
{ id: 29, inches: 0.2090, mm: 5.30680 },
{ id: 32, inches: 0.2106, mm: 5.34924 },
{ id: 32, inches: 0.2103, mm: 5.34162 },
{ id: 34, inches: 0.2107, mm: 5.35178 },
@MatthewRDodds
MatthewRDodds / gist:e566e3447565fa929e613a3d48e93428
Created January 7, 2019 20:56
Add rails version numbers across migrations
# https://stackoverflow.com/questions/48815984/rails5-directly-inheriting-from-from-activerecordmigration-is-not-supported-s
grep -rl "ActiveRecord::Migration" db | xargs sed -i "" "s/ActiveRecord::Migration/ActiveRecord::Migration[5.1]/g"
[7508781, 7508787, 7508789, 7508794, 7508798, 7508802, 7508804, 7508807, 7508811, 7508815, 7508819, 7508822, 7508828, 7508832, 7508835, 7508839, 7508843, 7508847, 7508850, 7508853, 7508856, 7508858, 7508861, 7508863, 7508866, 7508869, 7508870, 7508873, 7508875, 7508877, 7508880, 7508883, 7508886, 7508887, 7508888, 7508889, 7508890, 7508891, 7508892, 7508893, 7508894, 7508895, 7508909, 7508910, 7508911, 7508912, 7508914, 7508916, 7508917, 7508918, 7508919, 7508920, 7508921, 7508922, 7508923, 7508924, 7508925, 7508926, 7508927, 7508928, 7508930, 7508932, 7508933, 7508934, 7508943, 7508944, 7508945, 7508946, 7508948, 7508950, 7508951, 7508952, 7508953, 7508954, 7508955, 7508956, 7508957, 7508958, 7508959, 7508960, 7508961, 7508963, 7508964, 7508965, 7508967, 7508968, 7508969, 7508970, 7508972, 7508973, 7508975, 7508976, 7508977, 7508978, 7508979, 7508980, 7508981, 7508982, 7508991, 7508992, 7508993, 7508994, 7508995, 7508996, 7508997, 7508998, 7508999, 7509000, 7509001, 7509002, 7509004, 7509005, 7509006, 750900
@MatthewRDodds
MatthewRDodds / complicator.rb
Created March 19, 2018 15:27
Text complication script lols
require 'thesaurus'
new_text = ""
text = ARGV[0]
words = text.split(' ')
words.each do |word|
syns = Thesaurus.lookup(word.downcase).map(&:words).flatten!
if !syns.nil? && syns.any?
new_text << syns.sort_by(&:length).last
@MatthewRDodds
MatthewRDodds / bookmark-launch-script.js
Last active February 26, 2024 07:23
Bookmark Launch Script
// ==UserScript==
// @name Bookmark Launcher
// @description Launches bookmakrs with keyboard shortcuts
// ==/UserScript==
// https://superuser.com/questions/496212/shortcut-to-open-specific-bookmark-url-in-chrome
// chrome://chrome/extensions/
var bookmarkLauncherSetup = (function() {
var bookmarks = {}, url;
@MatthewRDodds
MatthewRDodds / pragprog.md
Last active June 24, 2017 12:01
Pragmatic Programmer

Pragmatic Programmer Notes

A Pragmatic Approach

Duplication

Dry Principle:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

# starting
git bisect start
git bisect bad
git bisect good GOOD_COMMIT_HASH
...
# finishing
git bisect reset
@MatthewRDodds
MatthewRDodds / troubleshooting_methodology.md
Created April 25, 2017 02:45
Troubleshooting methodology

Troubleshooting Methodology

Source

Investigation

  • Problem Statement: Create a clear, concise statement of the problem.
  • Problem Description: Identify the symptoms. What works? What doesn't?
  • Identify Differences and Changes: What has changed recently? What is unique about this system?
@MatthewRDodds
MatthewRDodds / keybase.md
Created March 30, 2017 22:09
keybase.md

Keybase proof

I hereby claim:

  • I am matthewrdodds on github.
  • I am matthewdodds (https://keybase.io/matthewdodds) on keybase.
  • I have a public key ASBz2sL2z3zbMbKWkS6WJp3e9DrgwRxn0-qM5-RXEPqxxgo

To claim this, I am signing this object: