Skip to content

Instantly share code, notes, and snippets.

@mgiacomini
mgiacomini / main.go
Created June 10, 2025 12:08
golang DI
// main.go
package main
import (
"context"
"errors"
"log"
"net/http"
"os"
"os/signal"
@mgiacomini
mgiacomini / most-touched-files.sh
Created December 21, 2022 15:52
Most touched files
git log --format=format: --name-only --since=12.month| egrep -v '^$' | sort | uniq -c | sort -nr | head -50
@mgiacomini
mgiacomini / domain_structure.ex
Created April 18, 2020 19:28
domain_structure.ex
defmodule CustomerManagement.Accounts do
@moduledoc """
Accounts context.
Use this context for any interaction with business rules with person or company related.
"""
alias CustomerManagement.Accounts.Person
alias CustomerManagement.Accounts.Commands.CreatePersonCommand
defmodule CustomerManagement.Origination.Commands.CreateProposalCommand do
use Ecto.Schema
import Ecto.Changeset
alias MyApp.Repo
alias Ecto.Multi
alias CustomerManagement.Origination.Proposal
alias CustomerManagement.Origination.Events.ProposalCreatedEvent
"realty_regularized" => $bean->realty_regularized_c,
"description" => $bean->description,
"guarantee_address_state" => $bean->guarantee_address_state_c,
"primary_phone_number" => $bean->primary_phone_number_c,
"digital_signature" => $bean->digital_signature_c,
"trading_name" => $bean->trading_name_c,
"registration_reason" => $bean->registration_reason_c,
"realty_registred" => $bean->realty_registred_c,
"credit_analysis_date" => $bean->credit_analysis_date_c,
"amortization" => $bean->amortization_c,
{
"opportunity": {
"opportunity": {
"sales_stage": "Lead Qualificado",
"registered_realty": false,
"realty_value": 15000000,
"realty_type": "registred_residential_property",
"payment_term": 240,
"paid_value": null,
"paid_realty": false,
@mgiacomini
mgiacomini / contract_mappings.ex
Created August 8, 2019 13:54
contract_mappings
@contract_mappings %{
external_id: %{
field: "NUMERO_CONTRATO",
type: :string
},
enterprise_name: %{
field: "NOME_EMPREENDIMENTO",
type: :string
},
enterprise_id: %{
@mgiacomini
mgiacomini / install.sh
Created July 19, 2019 14:08
Install helm for k8s
helm init
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl create serviceaccount --namespace kube-system tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
@mgiacomini
mgiacomini / doom.txt
Created June 24, 2019 17:26 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@mgiacomini
mgiacomini / mappings.ex
Created June 14, 2019 17:55
pipefy mappings
@statuses %{
"1.0 Cobrança Jurídica" => %{
"Leilão" => {:foreclosure_auction, "auction_in_progress"},
"Tentativa de Negociação" => {:notification, "attempt_to_negotiate"},
"Não Notificar (Casos de exceção)" => {:notification, "not_notify"}
},
"1.1 Notificação" => %{
"Emissão" => {:notification, "notification_in_progress"},
"Envio e Custas" => {:notification, "notification_in_progress"},
"Análise do Cartório" => {:notification, "notification_in_progress"},