Skip to content

Instantly share code, notes, and snippets.

View eduardodeoh's full-sized avatar
🏠
Working from home

Eduardo de Oliveira Hernandes eduardodeoh

🏠
Working from home
  • São José do Rio Preto / SP / Brasil
View GitHub Profile
@PJUllrich
PJUllrich / big-o.md
Last active April 28, 2024 14:19
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@rponte
rponte / using-uuid-as-pk.md
Last active May 2, 2024 11:01
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

require 'dry-validation'
SCHEMA = Dry::Validation.Schema do
configure do
config.input_processor = :sanitizer
def self.messages
Dry::Validation::Messages.default.merge(en: { errors: { unique?: "oops not unique" }})
end
require 'dry-validation'
SCHEMA = Dry::Validation.Schema do
configure do
config.input_processor = :sanitizer
def self.messages
Dry::Validation::Messages.default.merge(en: { errors: { unique?: "oops not unique" }})
end
@haggen
haggen / README.md
Last active September 11, 2018 03:19
boot2docker on nfs

Get boot2docker working with nfs instead of vboxsf.

Tested on:

- Boot2Docker-cli version: v1.6.0
  Git commit: 9894ae9
- Boot2Docker-cli version: v1.6.2
  Git commit: cb2c3bc
@maetl
maetl / gist:4542fc2390eb8701284e
Last active September 30, 2015 21:54
Using transproc to compose various hash transformations and mappings
require 'transproc/all'
require 'addressable/uri'
##
# Convert string keys to symbols
#
transform = Transproc(:symbolize_keys)
data = {
'name' => 'Mark Rickerby',
@rothgar
rothgar / main.yml
Last active March 8, 2024 07:16
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@leandrocp
leandrocp / rails3_bootstrap.rb
Created August 5, 2012 22:26
Rails 3 bootstrap
# rails3_bootstrap.rb
#
# rails new project --skip-test-unit -m rails3_bootstrap.rb
require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']
# Limpeza
#-------------------------------------------------------------------------------
say("Limpando arquivos", :yellow)