Skip to content

Instantly share code, notes, and snippets.

View garybernhardt's full-sized avatar

Gary Bernhardt garybernhardt

View GitHub Profile
open Parser;;
open Stringutil;;
type t = String of string | List of t list
let rec of_module m =
List (String "module" :: of_definitions m)
and of_definitions ds =
List.map of_definition ds
git diff --name-status head~3000..head | grep '^D' | awk '{print $2}' | while read f; do git log -1 --pretty="format:%H" -- "$f"; done > temp.txt
module RenderToHTML
def self.book
[title, css, body].join("\n")
end
private
def self.title
commit_hash = `git log -1 --pretty="format:%H"`
%{
# Has your OS/FS/disk lost your data?
# cd to the directory containing your project repositories and run the command
# below. (It's long; make sure you get it all.) It finds all of your git repos
# and runs paranoid fscks in them to check their integrity.
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK"
# I have 81 git repos in my ~/proj directory and had no errors.
find $(manpath | tr ':' '\n') -iname '*.1' | xargs cat | (LC_CTYPE=C tr -C '[:alnum:]-_' '\n') | egrep '^--[\-_[:alnum:]]+$' | sort | uniq -c | sort -n
require "erb"
require "pathname"
DOT_TEMPLATE=<<-END
digraph {
size="20,20";
overlap=false;
sep=0.4;
graph [fontname=Helvetica,fontsize=10];
node [fontname=Helvetica,fontsize=10];
Turning The Design Clock Back
Object-oriented design principles haven't had the effect we hoped for. The
SOLID principles are excellent design guidelines, but experience shows that
programmers find them difficult to follow. What do we do about this?
Surprisingly, the Structured Design literature of forty years ago contains
compelling solutions to many current design problems. They're simple and easy
to understand, but were lost in the noise as OO rose to popularity. We'll
reinterpret these simple design ideas in a modern context, finding that many of
our most promising new design ideas resemble them. Rapid web application
(Chapters marked with * are already written. This gets reorganized constantly
and 10 or so written chapters that I'm on the fence about aren't listed.)
Programmer Epistemology
* Dispersed Cost vs. Reduced Cost
* Verificationist Fallacy
* Mistake Metastasis
The Overton Window
Epicycles All The Way Down
The Hyperspace Gates Were Just There
failbowl:selecta(scoring_redesign) $ ruby ../readygo/readygo.rb --compare benchmark.rb
.!.!.!.!.!.!.!.!..!.!.!.!.!.!.!.!.!.!...!.!.!.!.!.!.!.!.............................................................................................................
filtering non-matching
Baseline: | X-----------|
Current: | X--------- |
0 6.848 ms
filtering matching exactly
Baseline: | X-------------------|
it "requires an amount_charged greater than 0" do
order = FactoryGirl.build(:order, :amount_charged => 0)
order.valid?.should == false
order.errors[:amount_charged].should == ["must be greater than 0"]
end