Skip to content

Instantly share code, notes, and snippets.

@israelb
israelb / instructions.sh
Created September 12, 2023 16:00
Update bundler ruby on rails Gemfile.lock
1. Install the latest bundler version:
gem install bundler
2. Update the bundler version in Gemfile.lock
bundle update --bundler
3. Confirm it worked:
@israelb
israelb / reservation.md
Last active June 8, 2023 21:33
Reservation Pattern

The Reservation Pattern

Introduction

The reservation pattern is a pattern for dealing with message reissues. That is, when the sender of a message sends the same message twice. Because of the laws of distributed systems, it is impossible for a sender to know if their message was received with 100% confidence. Senders will often approach this problem by utilizing "at-least-once" delivery. In other words, they may send the same message more than once.

@israelb
israelb / fix_NSCFConstantString_initialize.txt
Created May 17, 2023 15:16 — forked from zanetagebka/fix_NSCFConstantString_initialize.txt
Solve issue with objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
# If you have issue with
# objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
# objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
# I had this problem when running `bin/rails c` on Mac M1 Pro. The solution for this is below
$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
$ export DISABLE_SPRING=true
This should help.
@israelb
israelb / curl.md
Created January 25, 2023 20:59 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@israelb
israelb / cucumber-rails.md
Created February 2, 2022 20:03 — forked from stepheneyer/cucumber-rails.md
BDD testing using Cucumber, Capybara, and Rails

#Cucumber and Capybara - Behavior Driven Development

##Overview

Cucumber allows software developers to describe how software should behave in plain text. The text is written in a business-readable, domain-specific language. This allows non-programmers to write specific feature requests that can be turned into automated tests that drive development of the project.

Capybara is the largest rodent known to man.

@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

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 / 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})$/
@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" => "aaron@destacame.cl",