Skip to content

Instantly share code, notes, and snippets.

View ldlsegovia's full-sized avatar

Leandro Segovia ldlsegovia

View GitHub Profile
@ldlsegovia
ldlsegovia / engines.md
Created August 19, 2021 18:58
Rails engines/gems modularización

Modularización

Para modularizar el monolito, estamos usando engines de Rails.

Generador

Para facilitar la tarea de crear nuevos engines y gemas, usamos Gemaker de la siguiente manera:

bin/gemaker new nombre_engine

Rails Modular

Ventajas:

  • Se puede cooperar sin miedo a tocar algo de otro engine.
  • Acotar los features/problemas. No es necesario lidiar con toda la complejidad de la app. Motivo principal por el que vamos a modularizar yo creo.
  • Los tests puede correr isolated.

Desventajas:

Me imagino algo así:

Ledgerizer.setup do |conf|
  conf.tenant(:subsidiary, currency: :clp) do
    conf.liability :user_funds_custody, currencies: [:clp, :btc] # estas son las currencies que acepta la cuenta
    conf.asset :user_funds_to_confirm, currencies: [:clp, :btc]

    conf.entry :user_deposit, document: :ledger_line do
      conf.debit account: :user_funds_to_confirm, accountable: :account
@ldlsegovia
ldlsegovia / requerimientos-api-sii.md
Last active August 19, 2019 15:41
Requerimientos API Rest SII

API Rest SII

Crear sociedades

Endpoint:

POST /tax-accounts

Atributos en el body:

ENV['RAILS_ENV'] = ARGV[0] || 'production'
DIR = File.dirname(__FILE__)
require DIR + '/config/environment'
Migration::FillDemoPriceChanges.for
@ldlsegovia
ldlsegovia / PDFtk.md
Last active February 18, 2018 16:21 — forked from jvenator/gist:9672772a631c117da151
PDFtk Server Install Workaround for Mac OS X

Installing PDFtk Server edittion on your Mac

This workaround install is necessary because PDFtk was pulled from homebrew-cask due to issues with it aggressively overwriting file permissions that could impact other installed libraries. See this homebrew-cask issue.
The following steps worked on Mac OS X 10.10.1 with a standard brew installation for the PDFtk Mac OS X server libary version 2.02.
All Terminal commands separated by a full line space. Some commands wrap into multiple lines.

Download and extract the Mac OS X server install pacakge

@ldlsegovia
ldlsegovia / capybara cheat sheet
Created July 30, 2017 00:26 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
ENV['RAILS_ENV'] = ARGV[0] || 'production'
DIR = File.dirname(__FILE__)
require DIR + '/config/environment'
class LoadOldValues
include PricingLogger
def initialize(realm)
raise 'invalid realm' unless ["gasco", "enex"].include?(realm)
@realm = realm
ENV['RAILS_ENV'] = ARGV[0] || 'production'
DIR = File.dirname(__FILE__)
require DIR + '/config/environment'
class DupPriceChanges
include PricingLogger
def initialize(realm)
raise 'invalid realm' unless ["gasco", "enex"].include?(realm)
@realm = realm
@ldlsegovia
ldlsegovia / local_resource.rb
Created June 25, 2016 16:13
Simple class to create a tmp local file from a url
require 'open-uri'
class LocalResource
def initialize(_url, _tmp_filename)
@uri = URI.parse(_url)
@tmp_file_name = File.basename(_tmp_filename, ".*")
@tmp_file_ext = File.extname(_tmp_filename)
end
def file