Skip to content

Instantly share code, notes, and snippets.

Craig Buchek booch

Block or report user

Report or block booch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@booch
booch / HTML_Templating_Patterns.md
Last active Jan 2, 2018
HTML Templating Patterns
View HTML_Templating_Patterns.md

HTML Templating Patterns

I've decided to try documenting the different patterns used in HTML templates. By HTML templates, I mean taking some HTML(ish) text, and inserting dynamically-generated content. This templating can take place on the web server or in the browser; the patterns don't usually differ between the two.

Delimited HTML

@booch
booch / morf.rb
Last active Oct 27, 2015
MORF (generic hexagonal Ruby framework) ideas
View morf.rb
# MORF - My Own Ruby Framework #
# This is based on Uncle Bob's talk at Midwest Ruby 2011,
# [Architecture the Lost Years](https://www.youtube.com/watch?v=WpkDN78P884),
# as well as his article on [Clean Architecture](https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html).
# Also inspired by Gary Bernhardt's [Boundaries](https://www.youtube.com/watch?v=yTkzNHF6rMs) talk,
# and lots of other immutability (functional core) ideas being used within OOP programming (like Piotr Solnica's work).
ENV['DB_URL'] = 'memory:morf_example'
@booch
booch / prereqs.md
Created Apr 20, 2015
Prerequisites for HTTP Workshop
View prereqs.md

Please have Vagrant and VirtualBox installed ahead of the workshop, if possible. We'll be providing a virtual machine (on USB keys) with the lab exercises. Having Vagrant ready to run the VM will help us get started quickly. That said, we'll have a few minutes of slide presentation to get started. You might be able to get things working then. If you're unable to get Vagrant working, we'll have you pair up with a neighbor.

@booch
booch / gist:bbd6c40e3c984074da33
Last active Aug 29, 2015
Callback ideas for hexagonal Rails controllers
View gist:bbd6c40e3c984074da33
# From http://blog.boochtek.com/2015/02/23/hexagonal-rails-controllers
class OrderController < ApplicationController
def index
interactor.on(:display) { |orders| render orders }
interactor.list
end
def show
interactor.on(:display) { |order| render order }
View gist:b9a764c747d4c1c51680
* '...' - Using for Atom.
* "..." - Using for Text.
* [...] - Using this for List (and maybe Map).
* {...} - Using this for Block.
* <...> - No good, as it's too hard to parse differently than < and >.
* (...) - Already overloaded for precedence and method call invocation. Tuple?
* [<...>] - Looks like a really good choice. Map?
* [!...!] - Might be too hard to parse ! inside a List then. (Unless we don't have a ! operator.)
* [@...@] - Probably too hard to parse $ sigil inside a List then.
* [#...#] - Probably too hard to parse comments then. Might use for nestable block comments.
@booch
booch / Code Review Guidelines.md
Last active Nov 21, 2017
Some guidelines for doing a code review
View Code Review Guidelines.md

Here are some general guidelines to consider when reviewing a pull request:

  • Is the code covered by tests? *
  • Are there any tests cases that are missing? *
    • Unit tests - for any model changes *
    • Acceptance tests - ???infrastructure needed
    • Integration tests - for any front end behavior change *
    • Black box testing? infrastructure needed
    • Controller tests - for any controller changes *
  • Rake / release tasks - manually run them? *
@booch
booch / new_laws.md
Created Oct 29, 2014
Ideas for new laws
View new_laws.md

These are ideas that came up during reading articles and discussions about the recent happenings in Ferguson.

New Laws

  1. All police officers shall have their names clearly displayed at all times while in uniform. Violation shall be a felony of impersonating a police officer. The names must be in a legible font, at least 30 points in size.

  2. All police officers shall wear video recording devices. These recordings shall

@booch
booch / generative-poc.rb
Created Aug 25, 2014
Proof of concept for an idiomatic RSpec generative testing library
View generative-poc.rb
# TODO:
#
# Allow specifying number of runs.
# Ensure child contexts get run multiple times.
# Check what happens on failure in one of the runs.
# Different color for dots.
# Shrinking.
module RandomlyGenerated
View Ruby ORMs.md

Ruby ORMs

Abstract

Rails is really a collection of pieces that can be put together to create a web app. You can enhance or replace many of the components - how you write views, how controllers work, and how you build models. While models are built on top of ActiveRecord in the

@booch
booch / signature_checking.rb
Created Jan 14, 2014
What if we could check type signatures in Ruby? A proof of concept.
View signature_checking.rb
# Allow multiple classes to be declared via A|B instead of [A, B].
class Class
def |(*other_classes)
SetOfClasses.new(self, other_classes)
end
end
require 'set'
class SetOfClasses
attr_reader :classes
You can’t perform that action at this time.