I’ve automated the generation of the blog using Travis CI. Using this new way, each commit generates a new version of the pages.
These resources have been very useful:
Prose.io + Octopress + Travis-CI + GitHub Pages = ♥. First post (in this set) that explains how this automation is possible Auto-deploying to My Octopress Blog With Travis-CI. Explains how to generate your key, encript it with travis Octopress + GitHub Pages + Travis: The most useful page, explains step by step what to do for mac and linux.
Ruby Equality And Object Comparison I’ve read this article, written by Alan Skorkin, that explains equality comparisons in ruby:
equal? is reference equality == is value equality eql? is value and type equality Tags: ruby, comparison, equality, object, reference, alan-skorkin
Software Folklore I’ve watched this PechaKucha by Chris Ford on what are laws and how they relate to creating software. Also talks on what could be an analogy to software creation (says not science, not engineering)
Collection of HOFs Select Attribute class Array def select_attribute attr self.map { |unit| unit[attr] } end end usage:
[71] pry(main)> [ {:element => 1, :even? => false}, {:element => 2, :even? => true}, {:element => 3, :even? => false}] .select_attribute :even? => [false, true, false] Collection of patterns Decorating a collection Introduction You want to materialize properties from a collection
Alternative names Intermediary Functional decorator Collection Annotation (from Wallingford’s Roundabout, especially Interface procedure) Example [62] pry(main)> [1,2,3] .
Call me maybe: RabbitMQ I’ve read this article by Kyle Kingsbury on using RabbitMQ as a lock service. It investigates and gives a counterexample of using it for this purpose.
Uses Knossos to do the testing and surfaces a problem with it. Explains specific problems on locking: at-most-once and at-least-once message delivery
Note: References Jepsen (I guess an inside joke to the song “Call me maybe” by Carly Rae Jepsen) for at-most-once and at-least-once message delivery.
In Ruby, you can query the methods an object accepts:
pry(main)> 1.methods => [:to_s, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, ... In case you want to call all methods, this can be useful (plus its tests):
def call_all_methods(object, *args) # remove methods that modify the PRY environment or are too verbose success = {} error = {} exclusions = [:pry, :methods, :private_methods, :public_methods, :gem].map { |x| x.
Motivation At a client, one of the projects has a long building process and the tests are mostly slow, so I use a local building pipeline, an example of the Pipes and Filters pattern.
This allows for executing manually only the fast unit tests, then automatically (no user intervention, no time spent) executing the rest of them before pushing. In case the latter fails, it is possible to do git push -f to the pipeline without corrupting the central repository (origin) history, possibly disturbing others.