AWS query-instance_method docs
export AWS_ACCESS_KEY_ID=‘XXXX’
export AWS_SECRET_ACCESS_KEY=‘XXXX’
# ENV['AWS_ACCESS_KEY_ID']
# ENV['AWS_SECRET_ACCESS_KEY']
docker run -\ | |
-rm=true \ | |
-v $WORKSPACE/src:/gopath/src/github.com/foo/bar/src \ | |
-v $WORKSPACE/src:/app \ | |
-e "GOPATH=/gopath" \ | |
-w /app golang:1.5 sh \ | |
-c 'CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags=\"-s\" -o bar' | |
# Refactor: | |
# Set the working directory to `/gopath/src/github.com/foo/bar/src |
<<-FOO.gsub /^\s+/, "" | |
abc | |
def | |
ghi | |
jkl | |
FOO |
AWS query-instance_method docs
export AWS_ACCESS_KEY_ID=‘XXXX’
export AWS_SECRET_ACCESS_KEY=‘XXXX’
# ENV['AWS_ACCESS_KEY_ID']
# ENV['AWS_SECRET_ACCESS_KEY']
{ | |
"name": "WebScraping", | |
"main": "scrap.js", | |
"dependencies": { | |
"cheerio": "~0.13.1" | |
} | |
} |
function sum(a, b, done) { | |
// we convert this otherwise sync function into an async function | |
// note: this forces itself into the next event loop | |
// we should use setImmediate instead which places it at | |
// the bottom of the current event loop stack | |
process.nextTick(function() { | |
// `done` is the callback function passed into `sum` | |
done(null, a + b) | |
}); | |
} |
class Foo | |
def <<(something) | |
puts something | |
end | |
def say(something) | |
puts something | |
end | |
end |
# As expected the output is the key, then the value... | |
({ :key => :value, :foo => :bar }).reduce([]) { |pass_through, item| | |
puts item | |
} | |
# key | |
# value | |
# foo | |
# bar |
class Dependency | |
def initialize(foo, bar, baz) | |
@foo = foo | |
@bar = bar | |
@baz = baz | |
end | |
def data | |
{ :foo => @foo, :bar => @bar, :baz => @baz } | |
end |
Aspect Oriented Programming is a means to change the behaviour of – or add behaviour to – methods and functions (including constructors) non-invasively. The added behaviour is called “advice” and can be added before, after, or around the function it advises.
This description is similar to the Extract Surrounding refactoring method. The difference is in the direction of the change. It seems AOP is more focused at modifying existing behaviour non-invasively; where as the Extract Surrounding Method actually changes the source code to allow this type of behavioural modification.