Skip to content

Instantly share code, notes, and snippets.

View blaix's full-sized avatar

Justin Blake blaix

View GitHub Profile
ne() {
$(npm bin)/$*
}
# run binary from project's node_modules/.bin dir
# ex: ne coffee
# see http://stackoverflow.com/a/15157360/193813
# alias ne="PATH=$(npm bin):$PATH"
# above alias not working for me, using function instead:
ne() {
$(npm bin)/$*
}
# run binary from project's node_modules/.bin dir
# ex: ne coffee
# see http://stackoverflow.com/a/15157360/193813
# alias ne="export PATH=$(npm bin):$PATH"
# above alias not working for me, using function instead:
ne() {
$(npm bin)/$*
}
#!/bin/bash
set -e
echo "-----------------------------------------------------"
echo "Installing the essentials..."
echo "-----------------------------------------------------"
sudo apt-get update
sudo apt-get -y upgrade
man = ?@
class << man
attr_accessor :x, :y, :speed
def to_point
[x, y]
end
def speed
button, .btn-primary, .btn-info, .btn-success, .btn-warning, .btn-danger {
.btn();
}
@blaix
blaix / blerg.rb
Last active December 18, 2015 10:48
class Chore
def frequency
Frequency.const_get(frequency_class).new
end
def done?
frequency.within_current_period?(last_completed)
end
end
@blaix
blaix / service-objects.md
Created June 12, 2013 11:04
Martin Fowler on Service Objects via the Ruby Rogues Parley mailing list

On Tue, Mar 12, 2013 at 1:26 PM, Martin Fowler [email protected] wrote:

The term pops up in some different places, so it's hard to know what it means without some context. In PoEAA I use the pattern Service Layer to represent a domain-oriented layer of behaviors that provide an API for the domain layer. This may or may not sit on top of a Domain Model. In DDD Eric Evans uses the term Service Object to refer to objects that represent processes (as opposed to Entities and Values). DDD Service Objects are often useful to factor out behavior that would otherwise bloat Entities, it's also a useful step to patterns like Strategy and Command.

It sounds like the DDD sense is the sense I'm encountering most often. I really need to read that book.

The conceptual problem I run into in a lot of codebases is that rather than representing a process, the "service objects" represent "a thing that does the process". Which sounds like a nitpicky difference, but it seems to have a real impact on how people us

var listify = function(messages) {
return $.map(messages, function(msg) {
return "<li>" + msg + "</li>";
});
}
testing 1 2 3