Skip to content

Instantly share code, notes, and snippets.

View marlosirapuan's full-sized avatar
🏖️
Working from home

Marlos marlosirapuan

🏖️
Working from home
  • João Pessoa, PB - Brazil
  • 05:37 (UTC -03:00)
View GitHub Profile
@marlosirapuan
marlosirapuan / example_activejob.rb
Created October 5, 2019 00:41 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@marlosirapuan
marlosirapuan / docker-compose.yml
Created September 3, 2019 14:20
Mautic config
version: '3'
networks:
default:
driver: bridge
webproxy:
external: true
services:
db:
import React from "react"
import Checkbox from "./Checkbox"
import { render, fireEvent, cleanup } from "react-testing-library"
afterEach(cleanup)
it("testa check", () => {
const { getByTestId } = render(<Checkbox />)
fireEvent.click(getByTestId("meucheck"))
expect(getByTestId("meucheck").value).toEqual("123");
@marlosirapuan
marlosirapuan / test_helper.rb
Created July 25, 2019 20:02
Minitest hooks
class ActiveSupport::TestCase
def self.prepare
# Add code that needs to be executed before test suite start
end
prepare
def setup
# Add code that need to be executed before each test
end
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '5.1.3'
@marlosirapuan
marlosirapuan / docker-commands.md
Created May 21, 2019 18:02
Some Docker commands

STOP ALL CONTAINERS

$ docker stop $(docker ps -a -q)

REMOVE ALL CONTAINERS

$ docker rm $(docker ps -a -q)
@marlosirapuan
marlosirapuan / WebView.js
Created May 8, 2019 15:16
React Native navigationOptions stateless component
// app.js
const onPressOpenLink = async (url, title) => {
const { navigate } = props.navigation
navigate('Web', { url: url, title: title })
}
// webview.js
import React, { useState, useEffect } from 'react'
import { WebView } from 'react-native-webview'
@marlosirapuan
marlosirapuan / InputMask.md
Last active May 1, 2019 22:40
Ant Design with InputMask

Based on this comment

Fix warning when use react-hooks:
Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

// shared/InputMask.js

import { Input } from 'antd'
import React, { forwardRef } from 'react'
@marlosirapuan
marlosirapuan / fix_postgresql_mojave.md
Last active April 3, 2019 20:53
Fix bug brew install postgresql on macOS Mojave (pg_tblspc, pg_commit_ts etc..)

To fix errors like..

psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

...

could not open directory "pg_tblspc": No such file or directory
@marlosirapuan
marlosirapuan / Dockerfile
Last active April 29, 2019 14:39
Dockerfile (Ruby 2.6.2-alpine + yarn + libs + assets precompile)
FROM ruby:2.6.2-alpine
ENV APP_HOME /src/app
ARG app_env
ENV RAILS_ENV $app_env
ENV RAILS_ROOT $APP_HOME
ENV RAILS_SERVE_STATIC_FILES 1
ENV LANG C.UTF-8
ENV PATH /root/.yarn/bin:$PATH