Skip to content

Instantly share code, notes, and snippets.

View skmetz's full-sized avatar

Sandi Metz skmetz

View GitHub Profile

The Kindle format is proprietary. Amazon has an official tool for converting epub to the Kindle format, however it is illegal for us to use it[1] to generate the kindle version of 99 Bottles of OOP.

Therefore, we've had to generate a .mobi file using an unofficial tool, and the result is not as good as the official one.

It's perfectly legal for you to generate the .mobi yourself using Amazon's tool, kindlegen.

@skmetz
skmetz / pygmentize_code.sh
Created June 21, 2016 05:38
Script to create syntax highlighted RTF files
#!/bin/bash
# I edited the ruby lexer (line 637 in the following file...
# [skm@skmair2:/Library/Python/2.7/site-packages/pygments/lexers/agile.py
# to remove spacial handling of the word 'name'
# so I could use it as a variable/method name.
# This script come from Katrina, with these instructions:
# I've also attached the presentation.py file which is where the style
# is defined. The colors are normal hex values, so if you know how you
@skmetz
skmetz / BoosterConf 2015
Last active August 29, 2015 14:16
Workshop links
Please create a gist for your solution and place the link below:
@skmetz
skmetz / gist:d9f85bf050d836a89d15
Last active August 29, 2015 14:03
SPA2014 links to Bottles Implementations
@skmetz
skmetz / ruby_hierarchy.rb
Created December 10, 2013 21:27
Ruby Hierarchy Exploration
####################
# Exploring the Ruby Object Hierarchy
####################
1.class # => Fixnum
Fixnum.superclass
Fixnum.ancestors
# what is the class of any class?
Fixnum.class # => Class
Integer.class # => Class
@skmetz
skmetz / gilded_rose_test.rb
Last active May 30, 2017 18:42
Gilded Rose Test
# This simplest thing is to clone Jim's repo (https://github.com/jimweirich/gilded_rose_kata) and then
# put this file in the root directory.
gem 'minitest', '~> 4.7'
require "minitest/autorun"
require "minitest/reporters"
MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
require_relative './gilded_rose'
@skmetz
skmetz / careerbuilder_class_links.md
Last active November 27, 2022 01:29
CareerBuilder class links
class Bag < Hash
def add(obj)
increment_count(obj)
end
def increment_count(obj)
self[obj] = (cnt = self[obj]).nil? ? 1 : cnt + 1
end
From 164f12ca299a407d9d31f32e400daaef12ab736a Mon Sep 17 00:00:00 2001
From: Sandi Metz <skmetz@gmail.com>
Date: Mon, 15 Jun 2009 08:01:48 -0400
Subject: [PATCH] remove case statements, use double dispatch
---
actionpack/lib/action_view/helpers.rb | 2 +
actionpack/lib/action_view/helpers/form_helper.rb | 43 ++++++--------
.../helpers/form_helper_core_extensions.rb | 59 ++++++++++++++++++++
.../lib/action_view/helpers/prototype_helper.rb | 19 +------
@skmetz
skmetz / remove case statement
Created June 17, 2009 13:35
remove case statement from form_for, etc
From 164f12ca299a407d9d31f32e400daaef12ab736a Mon Sep 17 00:00:00 2001
From: Sandi Metz <skmetz@gmail.com>
Date: Mon, 15 Jun 2009 08:01:48 -0400
Subject: [PATCH] remove case statements, use double dispatch
---
actionpack/lib/action_view/helpers.rb | 2 +
actionpack/lib/action_view/helpers/form_helper.rb | 43 ++++++--------
.../helpers/form_helper_core_extensions.rb | 59 ++++++++++++++++++++
.../lib/action_view/helpers/prototype_helper.rb | 19 +------