Skip to content

Instantly share code, notes, and snippets.

View mauricioklein's full-sized avatar

Mauricio Klein mauricioklein

View GitHub Profile
@mauricioklein
mauricioklein / command.rb
Last active July 16, 2016 00:17
Rom-SQL error
module Persistence
module Commands
class CreateUserCompany < ROM::Commands::Create[:sql]
input Dry::Data['hash'].schema(
user_id: 'int',
company_id: 'int'
)
relation :user_company
register_as :create
def transfer
amount = params[:amount]
@client1.withdrawal(amount)
@client2.deposit(amount)
render status: :ok
end
@mauricioklein
mauricioklein / wallet_transfer_with_transaction.rb
Last active April 23, 2016 17:19
Wallet transfer example
def transfer
amount = params[:amount]
Wallet.transaction do
@client1.withdrawal(amount)
@client2.deposit(amount)
end
render status: :ok
end
@mauricioklein
mauricioklein / zssn.md
Last active April 16, 2024 14:12
Zombie Survival Social Network

ZSSN (Zombie Survival Social Network)

Descrição do Problema

O mundo finalmente atingiu o seu estado apocalíptico, onde uma pandemia causada por um virus de laboratório transforma seres humanos e animais em zumbis, seres sedentos por carne.

Você, como membro da resistência (e último sobrevivente com conhecimentos em desenvolvimento de software) foi incubido à desenvolver um sistema para compartilhamento de recursos entre os humanos não infectados.

Funcionalidades

@mauricioklein
mauricioklein / .travis.yml
Last active August 29, 2015 14:27
Travis file causing permission denied when trying to stop container
language: ruby
sudo: required
dist: trusty
services:
- docker
script:
@mauricioklein
mauricioklein / Admin.rb
Last active November 29, 2021 01:17
Has Many :through polymorphic problem
class Admin < ActiveRecord::Base
has_many :favorites, as: :favoritable
has_many :favorite_services, through: 'favorites', source: 'service'
end
@mauricioklein
mauricioklein / docker-compose.yml
Created May 27, 2015 16:20
Exemple of docker-compose.yml with port forwarding
api:
image: ruby
links:
- db
ports:
- "3000:3000"
db:
image: postgres