Skip to content

Instantly share code, notes, and snippets.

View gburtini's full-sized avatar

Giuseppe Burtini gburtini

View GitHub Profile
@gburtini
gburtini / test_induced_design_damage.rb
Created August 26, 2020 19:57 — forked from dhh/test_induced_design_damage.rb
This is an extraction from Jim Weirich's "Decoupling from Rails" talk, which explained how to apply the hexagonal design pattern to make every layer of your application easily unit testable (without touching the database etc). It only seeks to extract a single method, the EmployeesController#create method, to illustrate the design damage that's …
# 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
@gburtini
gburtini / optimization-descent-method.js
Last active November 20, 2017 06:25
Gradient descent, Newton's method and BFGS, all in one go.
// NOTE: return to revision 2 for a no-dependency, one dimensional version of gradient and Newton descent.
const { Matrconst { Matrix, Vector } = require('sylvester');
const { isEqual, omit } = require('lodash');
const defaults = {
gradientTolerance: 0.01,
maxIterates: 10,
dieOnBadStep: false,
allowNumericalDifferentiation: true,
allowBfgs: true,

Keybase proof

I hereby claim:

  • I am gburtini on github.
  • I am gburtini (https://keybase.io/gburtini) on keybase.
  • I have a public key whose fingerprint is 5C62 9E4C 0A5D AA6C 0D8B 27FE 4D09 3BE8 C030 9D5D

To claim this, I am signing this object:

@gburtini
gburtini / git.md
Created May 2, 2016 19:47 — forked from twoism-dev/git.md
Hybrid Git Flow

Our Git Flow

We are using a simple git flow based on git flow and github flow. We have two branches develop and master.

develop is a representation of staging

master is a representation of production

The Rules