Skip to content

Instantly share code, notes, and snippets.

Chris Habgood chabgood

Block or report user

Report or block chabgood

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
@chabgood
chabgood / gist:7b24c5b5463c51f1683319fdcd077308
Created Jan 2, 2019
save state db when changing branch
View gist:7b24c5b5463c51f1683319fdcd077308
#!/usr/bin/env ruby
require 'yaml'
class UnsupportedDatabaseAdapter < RuntimeError
attr_reader :adapter
def initialize(adapter)
@adapter = adapter
@chabgood
chabgood / gist:431271af6f29492348201ddf63a1fe0d
Created Apr 17, 2017
Find a the count of a word in a file
View gist:431271af6f29492348201ddf63a1fe0d
def find_word(word)
the_file="#{Rails.root}/app/models/release_asset.rb"
file = File.open(the_file, "r")
index = 0
file.each_line { |line|
if line.include?(word)
index+=1
end
}
@chabgood
chabgood / pre-commit
Last active Aug 2, 2016
git pre-commit hook prevent pry debug
View pre-commit
#!/usr/bin/env ruby
class CheckForDebug
def self.run
@files = `git grep --all-match -e 'binding.pry' --and --not -e 'add binding' --line-number`
exit_and_notify if @files.length > 0
exit 0;
end
def self.exit_and_notify
p @files.strip
You can’t perform that action at this time.