Skip to content

Instantly share code, notes, and snippets.

View kerrizor's full-sized avatar
🏍️
BRAAAAAAAAP!

Kerri Miller kerrizor

🏍️
BRAAAAAAAAP!
View GitHub Profile

Many of the best resources on the actual data behind code metrics are in white papers, dry IBM and .NET "Developer Zone" journals, and in Java land. Here's a bunch of links from when I was putting together my code metrics talk I gave at Steel City a couple years ago.

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery


OO Design Quality Metrics: An Analysis of Dependencies

http://www.objectmentor.com/resources/articles/oodmetrc.pdf

Oh, Uncle Bob.. you've already done everything cool, haven't you?

@kerrizor
kerrizor / .gitconfig
Last active August 29, 2015 14:23 — forked from jhelwig/.gitconfig
[alias]
review = log -p --reverse -M -C -C --patience
review-topic = !sh -c 'git review ${1}^1..${1}^2' -
view-topic = !sh -c 'git log --reverse --stat -M -C -C ${1}^1..${1}^2' -
@kerrizor
kerrizor / bullet_and_minitest.md
Last active January 31, 2024 00:07
Trigger MiniTest failures in Rails when Bullet detects N+1 query violations

In test/test_helper.rb...

### Bullet (N+1 queries)

if ENV['BULLET']
  Bullet.enable = true

  require 'minitest/unit'
’Twas brillig, and the slithy git repos
Did gyre and gimble in the wecks:
All mimsy were the borogoves,
And the mome raths Mutex.
“Beware the legacy code, my son!
The classes that bite, the patches that catch!
Beware the Gemfile.lock, and shun
The frumious monkey patch!”
’Twas brillig, and the slithy git repos
Did gyre and gimble in the wecks:
All mimsy were the borogoves,
And the mome raths Mutex.
“Beware the legacy code, my son!
The classes that bite, the patches that catch!
Beware the Gemfile.lock, and shun
The frumious monkey patch!”
@kerrizor
kerrizor / structs_vs_classes.md
Last active February 17, 2016 16:52
Structs vs Classes vs Classes-That-Inherit-From-Structs
require 'ostruct'
require 'benchmark'

ITERATIONS = 10_000_000
FOO        = "Bar"
BAZ        = "Bat"

NewStruct = Struct.new(:foo, :bar)
@kerrizor
kerrizor / copr.md
Created April 17, 2016 20:07 — forked from gvaughn/copr.md
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

Papers in Brian Troutwine's Moonconf talk:
"The Case of the Three Engineers vs. BART" :: Gordan Friedlander - 1974
"SIGSOFT Vol. 6 No. 2: Frontmatter" :: 1981
"The BUG Heard 'Round the World: Discussion of The Software Problem Which Delayed the First Shuttle Orbital Flight" :: John Garman - 1981
"Analyzing Software Requirements Errors in Safety-Critical, Embedded Systems" :: Robin R. Lutz - 1993
"Eliminating Embedded Software Defects Prior to Integration Test" :: Ted Bennett, Paul Wennberg - 2005
"Engineering a Safer World: Systems Thinking Applied to Safety" :: Nancy Leveson - 2011
"The Role of Software in Spacecraft Accidents" :: Nancy Leveson - 2004
"The OpenBSD Culture" :: David Gwynne - 2006

Crescent Wrenches, Socket Sets, and Other Tools for Debugging: Creating your own Toolkit of Inquiry

Software exists in a constant state of failure, facing pressure on many fronts - malicious intruders, hapless users, accidental features, and our own limits of imagination all conspire to bring our system to a screeching halt. Untangle even the most tangled of Gordian Knots by building your own toolkit for inquiry, by relying on the simplest technique of all: asking "why?"

@kerrizor
kerrizor / zom.rb
Created July 17, 2017 18:27 — forked from michaelfeathers/zom.rb
Find the number of calls in Ruby code that have happened no times, just once, or many times.
require 'set'
require 'find'
class Array
def to_h; Hash[self]; end
def to_set; Set.new(self); end
def freq; group_by {|e| e }.map {|k,v| [k,v.count] }.to_h; end
end