Skip to content

Instantly share code, notes, and snippets.

View ruanltbg's full-sized avatar
Ship it.

Ruan Carlos ruanltbg

Ship it.
View GitHub Profile
ruanltbg / migrate_refile_to_active_storage.rb
Created March 16, 2024 07:23
Migrate refile files to active storage
require 'mini_magick' # included by the image_processing gem
require 'aws-sdk-s3' # included by the aws-sdk-s3 gem
class MigrateRefileToActiveStorage
attr_accessor :model, :attribute
def initialize(model, attribute)
@model = model
@attribute = attribute
require "net/http"
require "uri"
not_in_trace = true
def checker
uri = URI.parse("")
http =, uri.port)
request =
ruanltbg /
Last active January 8, 2018 22:32 — forked from kpheasey/
WSL, RVM & RubyMine; ubuntu on windows, bash on windows

Add inbound firewall rule for TCP 2222

  • Windows 10 has 2 new services, SSH Server Proxy and SSH Server Broker which will already be bound to port 22
  • Do not allow public connection on this rule, WSL is not proven safe


Add as cmd startup with bash.exe --login

Install the SSH server and some Rails essentials libraries in bash

sudo apt-get update && sudo apt-get upgrade -y
ruanltbg /
Created August 3, 2017 21:08 — forked from glarrain/
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

ruanltbg / cpf_cnpj_validators.rb
Created July 27, 2017 17:41 — forked from gouvermxt/cpf_cnpj_validators.rb
validação de CPF e CNPJ em Ruby
# Rotinas para verificação de CPF e CNPJ
# Linguagem: Ruby
# Escrito por: André Camargo < >
# Use, copie, melhore a vontade! Patches são bem-vindos...
def check_cpf(cpf=nil)
return false if cpf.nil?
nulos = %w{12345678909 11111111111 22222222222 33333333333 44444444444 55555555555 66666666666 77777777777 88888888888 99999999999 00000000000}
ruanltbg / capybara cheat sheet
Created June 26, 2017 15:01 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
ruanltbg /
Last active August 1, 2016 13:59
Set up of a Rails + Nginx + Unicorn OR LAMP in Ubuntu


$ sudo apt-get update
$ sudo apt-get install apache2
# activate mod_rewrite
$ sudo a2enmod rewrite
$ sudo service apache2 restart