Skip to content

Instantly share code, notes, and snippets.

@israelb
israelb / dynamo_db_query_example.md
Created June 19, 2018 21:27 — forked from kenoir/dynamo_db_query_example.md
Prettied up some AWS Ruby SDK DynamoDB examples from @Integralist.

AWS query-instance_method docs

export AWS_ACCESS_KEY_ID=‘XXXX’
export AWS_SECRET_ACCESS_KEY=‘XXXX’
# ENV['AWS_ACCESS_KEY_ID']
# ENV['AWS_SECRET_ACCESS_KEY']
@israelb
israelb / nginx01_api.conf
Last active July 23, 2018 14:51
nginx.conf Front end prod.
user www-data;
worker_processes 4;
pid /run/nginx.pid;
worker_rlimit_nofile 30000;
events {
worker_connections 8192;
# multi_accept on;
}
@israelb
israelb / capybara
Created August 15, 2018 15:59
capybara problems
brew upgrade [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
bundle intall
https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#homebrew
Problem:
Fetching nokogiri 1.8.4
@israelb
israelb / who_is_my_mummy.sh
Created August 24, 2018 18:09 — forked from joechrysler/who_is_my_mummy.sh
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@israelb
israelb / openssl.sh
Created September 7, 2018 15:40
openssl
openssl req -nodes -newkey rsa:2048 -keyout yourdomain.key -out yourdomain.csr
@israelb
israelb / rubocop_pre_commit_hook
Created October 25, 2018 14:02 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED
@israelb
israelb / jwt
Created March 12, 2019 15:14
test jwt
require 'json_web_token'
data = { "City" => "REGION METROPOLITANA",
"Last_Name" => "Dominguez",
"Exterior_Number" => "",
"CURP" => "",
"Loan_Amount" => 23423.0,
"Monthly_Salary" => 234234.0,
"Second_Surname" => "",
"Email" => "[email protected]",
@israelb
israelb / rfc regex
Created September 24, 2019 14:44 — forked from gerardorochin/rfc regex
Expresion regular para validar RFC
/^([A-Z,Ñ,&]{3,4}([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z|\d]{3})$/

Interactor Gem (Service object)

It is based on the Command pattern, where each Command class/object represents a task and has one public method. Basically, something like:

PressButton.new(button).execute # or
PurchaseOrder.new(params).call # or even
Song::Create.(params) # or a proc
SendEmail.perform(email) # it could be a class method, why not?
@israelb
israelb / extensions.sh
Created May 23, 2020 18:58
extension visual code
code --install-extension akamud.vscode-theme-onelight
code --install-extension Arsen.darcula-theme-for-elixir
code --install-extension bungcip.better-toml
code --install-extension castwide.solargraph
code --install-extension CraigMaslowski.erb
code --install-extension donjayamanne.githistory
code --install-extension dsznajder.es7-react-js-snippets
code --install-extension eamodio.gitlens
code --install-extension eppz.eppz-code
code --install-extension esbenp.prettier-vscode