Skip to content

Instantly share code, notes, and snippets.

View dutradotdev's full-sized avatar
🎯
Focusing

lucas dutradotdev

🎯
Focusing
View GitHub Profile
@dutradotdev
dutradotdev / gist:d6357000e972f34767fc3796857b3b20
Created April 20, 2023 14:47
get the current simulator uuid
xcrun simctl list | egrep '(Booted)'
to log all console.log() in iOS release mode:
1. go to RCTLog (cmd shift o)
2. edit the method RCTLogTypeForLogLevel to:
static os_log_type_t RCTLogTypeForLogLevel(RCTLogLevel logLevel)
{
return OS_LOG_TYPE_ERROR;
}
3. rebuild the app
@dutradotdev
dutradotdev / gist:06fd6a582f2b3647da4f40a95f4a2477
Created April 20, 2023 14:35
check iOS device logs using console
brew install libimobiledevice
idevice_id --list // list available device UDIDs
idevicesyslog -u <device udid>
@dutradotdev
dutradotdev / .tsx
Last active May 31, 2024 02:16
BlurContainer in React Native
import React from 'react';
import WebView from 'react-native-webview';
export type RGBA = `rgba(${number}, ${number}, ${number}, ${number})`;
export interface BlurContainerProps {
backgroundColor: RGBA;
blurRadius: number;
}
Entrar no postgres:
- psql postgres
Criar usuário:
- CREATE ROLE strapi WITH LOGIN PASSWORD 'strapi';
Alterar senha para senha encriptada:
- ALTER USE strapi WITH ENCRYPTED PASSWORD 'strapi123';
Criar banco de dados:
@dutradotdev
dutradotdev / .js
Last active March 18, 2019 23:52
Herança + ES6
class Veiculo {
constructor(nome, valor, cor) {
this._nome = nome;
this._valor = valor;
this._cor = cor;
}
get cor() {
return this._cor;
}
@dutradotdev
dutradotdev / .js
Last active March 18, 2019 23:00
Herança com métodos e constructor correto
// agora a classe Ferrari extends Veiculo
Ferrari.prototype = Object.create(Veiculo.prototype);
// porém agora o constructor de Ferrari.prototype é igual
// ao de Veiculo.prototype... Precisamos resolver isso.
Ferrari.prototype.constructor = Ferrari;
let ff = new Ferrari();
ff.acelerar() // works!!
Ferrari.prototype.constructor // Ferrari
@dutradotdev
dutradotdev / .js
Last active March 18, 2019 22:19
Herança
function Veiculo(nome, valor, cor) {
this.nome = nome;
this.valor = valor;
this.cor = 'preto';
};
Veiculo.prototype.acelerar = function() {
console.log('aceleraaaaaa');
}
@dutradotdev
dutradotdev / .js
Created March 18, 2019 11:05
Prototype chain
/*
navegaremos de construtor a construtor até obter um erro
no final na prototype chain
*/
var set = new Set();
console.log(set);
// []
console.log(set.constructor);
// ƒ Set() { [native code] }
console.log(set.__proto__.constructor);
@dutradotdev
dutradotdev / .js
Last active March 18, 2019 01:07
CommonJS
// carregando o lodash na variável _
const _ = require('lodash');
function meuModulo() {
}
// você pode retornar uma função, objeto ou uma variável.
// agora o meuModulo pode ser importado usando o require.
module.exports = meuModulo;