Skip to content

Instantly share code, notes, and snippets.

Avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
View enumerable_with_context.rb
module Enumerable
def each_with_context(&block)
block.call([nil, self[0], self[1]])
self.each_cons(3, &block)
block.call([self[self.size - 2], self[self.size - 1], nil])
self
end
def enum_with_context
Enumerable::Enumerator.new(self, :each_with_context)
end
View redis-server-for-init.d-startup
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@mtodd
mtodd / sample.geojson
Created Jul 26, 2017 — forked from landonreed/sample.geojson
Playing around with http://geojson.io #osm github etc.
View sample.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mtodd
mtodd / jsonpp.rb
Created Nov 13, 2011
PrettyPrint JSON
View jsonpp.rb
require 'rubygems'
require 'yajl/json_gem' # or 'json'
require 'yaml'
puts JSON.parse($stdin.read.chomp).to_yaml
View Broken.md
  • First option
  • Parent option
  • Nested option
  • Last option
View code_review_checklists.md

Based on the article: Using checklists for code review

In general, people are pretty good at the code review process, but it's sometimes surprising what can slip through. A natural consequence of the way our brains look at the world is that it's easy to pay a lot of attention to small details and code style flubs, and completely miss the big picture.

Obviously, not everything is applicable for every change. If the review request isn't making any changes to UI, then skip the first two checklists entirely. If a change is a bug fix, typically don't review it for architecture and design principles.

Put the big stuff first (e.g. architecture). You don't want to work through a ton of small issues before realizing that everything has to be rewritten.

> Do a pass through the code for each and every item in the checklist. By only looking for a very specific type of defect, each pass goes relatively quickly, even for large changes. Focu

@mtodd
mtodd / _.md
Created Apr 22, 2013
Tributary inlet
@mtodd
mtodd / _.md
Created Apr 19, 2013
sin waves
View _.md
View active_record_master_company_of_first_firm_test_failure.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'