Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marlos marlosirapuan

🏠
Working from home
  • João Pessoa, PB - Brazil
View GitHub Profile
@marlosirapuan
marlosirapuan / Podfile
Created Jan 2, 2019
Podfile: fix bug RNSVG lib (SVG, QRCode)
View Podfile
##
# package.json:
# "react": "16.6.1",
# "react-native": "0.57.4",
# "react-native-qrcode-svg": "^5.1.1",
# "react-native-svg": "^8.0.10",
# 1) rm -rf node_modules/
# 2) yarn cache clean
# 3) yarn install
@marlosirapuan
marlosirapuan / Dockerfile
Last active Apr 29, 2019
Dockerfile (Ruby 2.6.2-alpine + yarn + libs + assets precompile)
View Dockerfile
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
@marlosirapuan
marlosirapuan / fix_postgresql_mojave.md
Last active Apr 3, 2019
Fix bug brew install postgresql on macOS Mojave (pg_tblspc, pg_commit_ts etc..)
View fix_postgresql_mojave.md

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 / Podfile
Created Apr 24, 2019
Podfile React Native 0.59.2
View Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Associados' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
# Pods for Associados
@marlosirapuan
marlosirapuan / InputMask.md
Last active May 1, 2019
Ant Design with InputMask
View InputMask.md

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 / WebView.js
Created May 8, 2019
React Native navigationOptions stateless component
View WebView.js
// 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'
View docker-commands.md

STOP ALL CONTAINERS

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

REMOVE ALL CONTAINERS

$ docker rm $(docker ps -a -q)
View ruby_custom_field_with_postgresql_and_metaprogramming.rb
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'
View test_helper.rb
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
View checkbox.test.js
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");