Skip to content

Instantly share code, notes, and snippets.

View mtodd's full-sized avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
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
#! /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 July 26, 2017 19:23 — forked from landonreed/sample.geojson
Playing around with http://geojson.io #osm github etc.
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 November 13, 2011 22:56
PrettyPrint JSON
require 'rubygems'
require 'yajl/json_gem' # or 'json'
require 'yaml'
puts JSON.parse($stdin.read.chomp).to_yaml
  • First option
  • Parent option
  • Nested option
  • Last option

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 April 22, 2013 09:24
Tributary inlet
@mtodd
mtodd / _.md
Created April 19, 2013 00:14
sin waves
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'