Skip to content

Instantly share code, notes, and snippets.

View estevaolucas's full-sized avatar
🏠
Working from home

Lucas Estevão estevaolucas

🏠
Working from home
View GitHub Profile
@estevaolucas
estevaolucas / README.md
Last active September 14, 2023 21:43
Performance comparison video

How to create a comparison video like this:

comparison-nometrics.mp4

Creating videos

You can create videos using one of the following methods

Local

@estevaolucas
estevaolucas / cloudSettings
Last active July 10, 2020 16:01
Config VSCode
{"lastUpload":"2020-07-10T16:01:40.846Z","extensionVersion":"v3.4.3"}
@estevaolucas
estevaolucas / fix-pbxproj.md
Created July 15, 2019 18:46
Fix pbxproj file -> Zeh's research and solution 🤯👏💪

The current project.pbxproj used by the iOS project is damaged in some way. While XCode can open the file and read its contents correctly, attempting to save it results in a crash. This files that crash, making the file editable again.

Well, pbxproj files are finicky. They are a constant source of pain when fixing merge conflicts, something that happens frequently in our project because of React Native updates.

While I can't say what caused the error with a lot of confidence, here's how it was diagnosed and fixed, for future reference when needed.

Diagnosis

XCode crashes create crash logs that go into ~/Library/Logs/DiagnosticReports/. In there, we could get a crash report that looked like this:

function getCoordinatesCenter(coordinates) {
let xcos = 0.0;
let ycos = 0.0;
let zsin = 0.0;
coordinates.forEach(coord => {
const lat = (coord.latitude * Math.PI) / 180;
const lng = (coord.longitude * Math.PI) / 180;
const acos = Math.cos(lat) * Math.cos(lng);
@estevaolucas
estevaolucas / App.js
Last active January 16, 2023 04:36
Font scale capping for React-Native
import * as React from "react";
import { NativeModules } from "react-native"
export default class App extends React.Component {
componentDidMount() {
if (IS_IOS) {
NativeModules.AccessibilityManager.setAccessibilityContentSizeMultipliers({
extraSmall: 0.823,
small: 0.882,
@estevaolucas
estevaolucas / fetch-with-loading.js
Created February 12, 2019 19:46
add a setNetworkActivityIndicatorVisible to every react-native fetch operations.
const globalFetch = global.fetch;
global.fetch = (url: string, params: Object): Promise<*> => {
return new Promise((resolve: any => void, reject: string => void) => {
StatusBar.setNetworkActivityIndicatorVisible(true);
globalFetch(url, params)
.then(resolve)
.then(reject)
.finaly(() => {
@estevaolucas
estevaolucas / example.js
Last active September 12, 2018 15:54
Simulate React-Native fontScale change
import { Slider, NativeModules } from 'react-native';
<Slider
maximumValue={ 2 }
minimumValue={ 1 }
onValueChange={ (value) => {
NativeModules.AccessibilityManager.setAccessibilityContentSizeMultipliers({
extraSmall: value,
small: value,
medium: value,
@estevaolucas
estevaolucas / AutoLink.js
Last active August 7, 2018 22:32
React Native component to detect phone number in a text and link on it
// @flow
import React from 'react';
import { TouchableOpacity } from 'react-native';
import debounce from 'lodash.debounce';
const TouchableDebounce = ({
children,
onPress,
...props