Skip to content

Instantly share code, notes, and snippets.

View garrettdimon's full-sized avatar

Garrett Dimon garrettdimon

View GitHub Profile
@garrettdimon
garrettdimon / gemfile_audit.rake
Last active December 19, 2023 14:21
A rake task to audit gems against latest versions
# Instructions:
#
# 1. Make sure to add the `gems` gem to your Gemfile so this can work:
# https://rubygems.org/gems/gems
#
# 2. Register at RubyGems.org and add your API key to ~/.gem/credentials
# and chmod the credentials file to 0600
#
# 3. Use this content to create `lib/tasks/gemfile_audit.rake`
#
@garrettdimon
garrettdimon / USAGE
Last active June 28, 2023 20:03
A basic example of a custom Rails generator with the full guide and explanation available at https://garrettdimon.com/journal/posts/creating-custom-rails-geenrators
Description:
Generates a plain Ruby class with the given NAME
Example:
`bin/rails generate plain Name`
This will create:
app/models/name.rb
test/models/name_test.rb
@garrettdimon
garrettdimon / debug.css
Last active April 10, 2023 16:05
A set of CSS rules to visually highlight common markup mistakes.
/*
In any of the following scenarios, a critical attribute was left off and needs
to be corrected.
*/
abbr[title=''],
abbr:not([title]),
a[href=''],
a[href='#'],
a:not([href]) {
color: var(--color-red-500) !important;
@garrettdimon
garrettdimon / rvw.md
Last active July 6, 2021 19:13
A quick overview of a tool to streamline using automated code review tools.

There's an abundance of truly great tools to help improve your codebase, but it's tough to remember all of the right parameters and options for each. And even then, it's a lot of typing.

I'm working on something to help make it easier and more natural to put all of these great tools to work together in a way that scales even if you have a dozen tools to run against your codebase, and even if you run some tools in one context and other tools in another context.

They'll consistently apply their correct configurations and make it friction-less to keep your code in tip-top shape.

What if, instead of...

> yarn audit --level moderate
@garrettdimon
garrettdimon / write.rb
Last active July 25, 2020 19:40
A Ruby script to facilitate starting to write a new Jekyll post and automatically do all the things related to preparing that.
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'pp'
class Article
attr_accessor :options, :file

Keybase proof

I hereby claim:

  • I am garrettdimon on github.
  • I am garrettdimon (https://keybase.io/garrettdimon) on keybase.
  • I have a public key whose fingerprint is 9A10 0003 5C0B B8E0 0E2A 77BE 995C 1631 EFC5 B651

To claim this, I am signing this object:

@garrettdimon
garrettdimon / fetch.rb
Created September 12, 2015 10:54
A basic script for downloading and saving attachments from a Sifter export file.
#!/usr/bin/env ruby
# To use this file, you'll need Ruby and Nokogiri installed.
# http://www.nokogiri.org
#
# If you're all set there simply place this file in the same folder as your
# Sifter export XML file and then run...
#
# `ruby fetch.rb`
#