At least four innovations in nutrient sources, preparation, and distribution underlie the transformation of our evolutionary ancestors into modern humans: the digging, preparation, and consumption of tubers and rhizomes; the technological mediation of hunting and butchering of animal prey; the socially mediated redistribution of animal prey; and the control of fire for cooking. The emergence of technologies for processing hard-to-obtain or difficult-to-digest foods such as animal protein, savanna tubers,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/inflector' | |
class Bar; end | |
def ControllerMixin(model) | |
model_class = model.classify.constantize | |
Module.new do | |
define_method(:"current_#{model}") do | |
model_class.find(session[:"current_#{model}_id"]) if session[:"current_#{model}_id"] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your ~/.ssh/config | |
Host pairgate | |
Hostname <central-pairing-server> | |
User <your-user-name> | |
Host pairhost | |
Hostname <central-pairing-server> | |
User <your-user-name> | |
RemoteForward localhost:2222 localhost:22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ADD LOCAL CONFIGURATION HERE | |
[diff] | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
[core] | |
editor = vim | |
[alias] | |
st = status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CardCreator < Struct.new(:listener) | |
def create(iteration, attributes) | |
card = iteration.cards.build(attributes) | |
if card.save | |
listener.created(card) | |
else | |
listener.create_failed(card) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
class ProtectionProxy < SimpleDelegator | |
def initialize(object, *writable_fields) | |
super(object) | |
@writable_fields = writable_fields | |
end | |
def method_missing(method, *args, &block) | |
method_name = method.to_s | |
if !method_name.end_with?('=') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host pairhost2 | |
Hostname lin.one42.co.uk | |
User mattwynne | |
Port 10022 | |
RemoteForward localhost:22222 localhost:22 | |
Host *.pair2 | |
ProxyCommand ssh -e none -ax pairgate nc -w 5 localhost %p 2>/dev/null | |
User pairing | |
LocalForward localhost:3000 localhost:3000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;solution presented | |
(def a | |
(fn [type & args] | |
(apply type args))) | |
;my original solution | |
(def a | |
(fn [type & args] | |
(eval (cons type args)))) |
James Ladd proposes a compass that we can use to navigate our object-oriented designs. We move North as we travel up a layer, South as we travel down a layer. West will take us away from the object, and East moves us towards another object.
James suggests that we orient our code so that we are always travelling East. In practice this means that code should follow these rules:
- All public methods return nil, boolean or return a reference to the current object (self).
- Objects that implement the Factory or Builder pattern or similar are an exception.
- East is better suited to composite objects, not primitive objects (James doesn’t make this distinction).