Skip to content

Instantly share code, notes, and snippets.

View xpepper's full-sized avatar
💭
😏

Pietro Di Bello xpepper

💭
😏
View GitHub Profile
@xpepper
xpepper / spike.md
Last active August 29, 2015 13:55
A spike on using postgresql's HSTORE to store metadata

A spike on using postgresql's HSTORE to store metadata on the Cover model (Exmu project)

These are the migration to start with.

The first one activate the extension HSTORE and adds an hstore column 'metadata' on the covers table

class AddMetadataToCovers < ActiveRecord::Migration
  def change
    execute 'CREATE EXTENSION hstore'
    add_column :covers, :metadata, :hstore
@xpepper
xpepper / .rspec
Created February 7, 2014 21:23 — forked from coreyhaines/.rspec
--colour
-I app
@xpepper
xpepper / image_asset.rb
Created February 8, 2014 22:50
An alternative solution to fetch extra data from elasticseach after finding a record from the db
class ImageAsset < ActiveRecord::Base
include Flex::ModelIndexer
flex.sync self
#...
after_find :fetch_extra_data_from_elasticsearch
def fetch_extra_data_from_elasticsearch
self.searchable ||= Flex.get(id: id, type: self.class.name.underscore)['_source']
# Original Rails controller and action
class EmployeesController < ApplicationController
def create
@employee = Employee.new(employee_params)
if @employee.save
redirect_to @employee, notice: "Employee #{@employee.name} created"
else
render :new
end
@xpepper
xpepper / Agile Coach definition (italian).md
Last active August 29, 2015 14:04
From the ExtremeProgramming-IT forum: "Chi è il coach agile?" (italian)

(from https://it.groups.yahoo.com/neo/groups/extremeprogramming-it/conversations/topics/11233)

Matteo Vaccari

Sono d'accordissimo che la competenza tecnica è fondamentale. Ma non è tutto; lo sviluppo software è un esercizio sociale e non è per niente scontato che mettere delle persone insieme produca la collaborazione desiderata. Anche se le persone sono bravissime tecnicamente. C'è dell'altro. Ci sono delle competenze specifiche che hanno a che fare con la collaborazione; ci sono delle skill che hanno a che fare con capire come interagire con le persone e capire come aiutare le persone a fare il prossimo passo. Bisogna studiarle. [...]

Quindi che cos'è un coach agile? Ci sono aziende che vogliono migliorare e si rendono conto di non riuscire a fare il passo completamente da soli. Il coach agile interviene lì. Qualche volta quello che faccio è consigliare una tecnica di programmazione, qualche volta spiego come funziona il planning game, qualche volta conduco una retrospettiva, qualche volta ascolt

@xpepper
xpepper / [xp-it] Il ruolo di Scrum Master e' un enorme spreco di potenziale umano.md
Last active August 29, 2015 14:09
Il ruolo di Scrum Master è un enorme spreco di potenziale umano (italian discussion on the xp-it newsgroup)

Paolo Perrotta:

Eppure XP "funziona", nel senso che migliora il modo di lavorare delle persone. E Scrum "funziona", nel senso che convince il manager intontito dalle puttanate che ha studiato (o più probabilmente da quelle che non ha studiato) a cambiare approccio, costruire team di persone invece che accozzaglie di risorse allocate al 25%, mettere insieme un backlog anziché arrancare dietro al già accaduto, focalizzarsi sul timebox anziché sul timesheet, eccetera. Se vi sembra poco, siete stati più fortunati di me.

Andrea Tomasini:

Scrum è stato uno dei primi approcci "Lightweight" documentati, è come tutti gli altri che hanno seguito sotto l'ombrello Agile aveva ed ha ancora oggi l'obiettivo principale di installare una "nuova" cultura del lavoro basata su rispetto, collaborazione, auto organizzazione e focus. In un contesto di cambio culturale, seguire alcune pratiche è un modo per realizzare quei pattern comportamentali che producono la cultura che si vuole raggiungere. Non è però l'unico modo

@xpepper
xpepper / Jenkins top slowest tests.md
Last active August 29, 2015 14:09
A shell script to extract from Jenkins the top slowest tests

Just connect to your Jenkins instance, localize the junit tests report folder (e.g. /data/jenkins/jobs/Jeronimo/workspace/Repository/target/surefire-reports) and then issue this shell command:

grep -h "<testcase" `find . -iname "TEST-*.xml"` | sed 's/<testcase name="\(.*\)" classname="\(.*\)" time="\(.*\)".*/\3\t\2.\1/' | sort -rn | head
@xpepper
xpepper / agile.chartering.md
Created April 4, 2015 15:43
agile chartering

Chartering

Chartering in agile projects has the same general goal, but a different level of detail and set of assumptions. The goal of a Charter is still to describe the project at a high level, gain agreement into the W5+ (What, Why, Who, When, Where and How) attributes of the project and give authority to proceed. However, since agile methods are often used on projects with uncertainty around requirements / technology, and high rates of change, there is typically less certainty around scope.

In general agile charters have less detail, are shorter documents, and focus more on how the project will be run than what exactly will be built. This is because when aiming at a static target (unchanging requirements / technology) it is appropriate to plan, plan some more and then execute. In the dynamic and moving target environment of an agile project lots and lots of planning may not be appropriate if elements of the project are likely to change. So, when aiming at a moving target, we need to allow for mid flight

@xpepper
xpepper / devops.md
Last active August 29, 2015 14:18
on devops...

The Devops movement addresses the dysfunction that results from organizations composed of functional silos: Devops proposes instead strategies to create better collaboration between functional silos, or doing away with the functional silos altogether and creating cross-functional teams (or some combination of these approaches).

The fundamental problem is this: Bad behavior arises when you abstract people away from the consequences of their actions. Functional silos abstract people away from the consequences of their actions.

The essence of Devops, I believe, is to design a system in which people are held responsible for the consequences of their actions – and indeed, one in which the right thing to do is also the easiest thing to do.

(There’s No Such Thing as a “Devops Team” http://continuousdelivery.com/2012/10/theres-no-such-thing-as-a-devops-team/)

@xpepper
xpepper / sales taxes problem.md
Last active August 29, 2015 14:22
sales taxes problem

Sales taxes problem

This problem requires some kind of input. You are free to implement any mechanism for feeding input into your solution (for example, using hard coded data within a unit test). You should provide sufficient evidence that your solution is complete by, as a minimum, indicating that it works correctly against the supplied test data.

PROBLEM: SALES TAXES

Basic sales tax is applicable at a rate of 10% on all goods, except books, food, and medical products that are exempt. Import duty is an additional sales tax applicable on all imported goods at a rate of 5%, with no exemptions.

When I purchase items I receive a receipt which lists the name of all the items and their price (including tax), finishing with the total cost of the items, and the total amounts of sales taxes paid. The rounding rules for sales tax are that for a tax rate of n%, a shelf price of p contains (np/100 rounded up to the nearest 0.05) amount of sales tax.

Write an application that prints out the recei