Skip to content

Instantly share code, notes, and snippets.

View mgraham's full-sized avatar

Michael Graham mgraham

  • Toronto, Canada
View GitHub Profile
@mgraham
mgraham / hey_notmuch!
Created May 17, 2022 07:00 — forked from vedang/hey_notmuch!
Notmuch configuration for Hey.com Style workflows.
- Specific Notmuch filters (and saved-searches) for:
+ The Feed (newsletters, blogs)
+ The Paper trail (receipts, ledger)
+ Screened Inbox (mail from folks you actually want to read)
+ Previously Seen (important mail that you've already read)
+ Unscreened Inbox (potential spam / stuff you don't want)
- Elisp Functions to move / categorize emails from a particular sender.
+ Adds tags needed by filters defined above to all email sent by a particular sender
+ Creates an entry in a DB file, which is used by the Notmuch post-new script when indexing new email, to auto-add the relevant tags.
@mgraham
mgraham / pre-commit
Created July 25, 2016 16:55 — forked from mileszs/pre-commit
Git pre-commit hook for prompting to remove binding.pry and debugger lines lines. (Includes a commented example of adding a check for focus in spec files.)
#!/usr/bin/env ruby
hits = []
checks = {
'_spec\.rb$' => ['focus: *true', 'focus *=> *true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
@mgraham
mgraham / track_attribute_changes.rb
Created April 23, 2015 21:31
Allow tracking whether ActiveType attributes have changed
module TrackAttributeChanges
extend ActiveSupport::Concern
include ActiveModel::Dirty
module ClassMethods
def track_attribute_changes(attr, type=nil)
self.module_eval <<-BODY, __FILE__, __LINE__ + 1
def #{attr}=(value)
changed = false
if "#{type}" == "datetime"