Skip to content

Instantly share code, notes, and snippets.

View iranjunior's full-sized avatar
🖥️
Coding

Iran Junior iranjunior

🖥️
Coding
View GitHub Profile
@iranjunior
iranjunior / main.dart
Created June 28, 2021 14:07
Escutando erros fora da estrutura do flutter
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
// Fica escutando os erros da thread em quer o app está rodando
Isolate.current.addErrorListener(RawReceivePort((pair) async {
// receber um par com o [Erro, Stack]
final List<dynamic> errorAndStacktrace = pair;
// Registra no firebase o erro
@iranjunior
iranjunior / main.dart
Created June 28, 2021 13:15
Criando uma zona de captura que abrange o app inteiro
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
// Executa o app dentro de uma zona segura, e caso aconteça um erro
// Ele será reportado para o crashlytics
runZonedGuarded(() async {
runApp(MyApp());
}, FirebaseCrashlytics.instance.recordError);
}
@iranjunior
iranjunior / home_page.dart
Last active June 28, 2021 12:48
Inserindo erros manualmente no crashlytics
void crashApp() async {
try {
throw Error();
} catch (e) {
await FirebaseCrashlytics.instance.recordError(
{'action': 'cliquei propositalmente', 'description': 'test'},
StackTrace.current,
fatal: true,
reason: 'Clicou propositalmente',
);
@iranjunior
iranjunior / .gitignore
Created June 21, 2021 23:43
Ignore files in apps flutter
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
@iranjunior
iranjunior / lists.dart
Last active June 21, 2021 20:07
Principais manipulações com Listas em Dart
void main() {
final test = [1, 2, 10, 9, 123, -1, -8];
// Ordenando um array
test.sort(); // saida: [-8, -1, 1, 2, 9, 10, 123]
// Filtrando um array
test.removeWhere((e) => e < 0); // saida: [1, 2, 10, 9, 123]
// Manipulando os valores do array
@iranjunior
iranjunior / post-merge
Created September 1, 2020 19:44 — forked from sindresorhus/post-merge
Git hook to install npm dependencies after a `git pull`. Run `chmod +x post-merge` and put it in `.git/hooks/`. Though could really do whatever.
#!/bin/sh
npm install
@iranjunior
iranjunior / snippets.md
Created July 8, 2020 17:20 — forked from bernardomafra/snippets.json
Snippets for Visual Studio Code

VSCode Custom Snippets

Para criar snippets personalizados para o seu Visual Studio Code, clique em File/Preferences/User Snippets.

Em seguida, escolha:
'New Global Snippets File' para criar snippets de maneira global
'New Snippets File for [REPOSITORY_NAME]' para criar snippets somente para o repositório atual

[RSL] React Stateless Component:

{
// Place your teste-mundiale workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"React Stateless": {
"scope": "javascript,typescript",
@iranjunior
iranjunior / answer.json
Last active May 14, 2020 16:20
Resolução do criptografia de Cesar
{"numero_casas":9,"token":"f784dd0d818b4e7e4b3d321ffa45a6c46bea0d48","cifrado":"cqn xwuh lxvyuncnuh lxwbrbcnwc ynxyun jan cqn mnjm. jumxdb qdgunh","decifrado":"the only completely consistent people are the dead. aldous huxley","resumo_criptografico":"b178a3576d0ce1ef78f9a295085c9e3df0c0fea6"}
@iranjunior
iranjunior / interview.md
Created April 27, 2020 17:15
500 Questions for interview ReactJS

React Interview Questions & Answers

Click ⭐if you like the project. Pull Request are highly appreciated. Follow me @SudheerJonna for technical updates.

Table of Contents

No. Questions
Core React
1 What is React?