Skip to content

Instantly share code, notes, and snippets.

View pauloantonelli's full-sized avatar

Paulo Antonelli pauloantonelli

View GitHub Profile
@pauloantonelli
pauloantonelli / colocar vscode como editor de git.txt
Created March 16, 2023 18:42
Colocar vsCode como Editor de Git
Vscode como editor padrão do git :
git config --global core.editor "code -w"
comando para verficar se a instalação foi feita correto :
git config --global -e
Se der algum erro como:
"hint: Waiting for your editor to close the file... code -w: code: command not found error: There was a problem with the editor 'code -w'".
Vá no VS Code > command(control) + shift + p > procure por code > escolha Shell Command: Install ‘code' command in PATH
@pauloantonelli
pauloantonelli / sourceTree_device_not_configured.txt
Last active February 23, 2023 13:24 — forked from RockinPaul/sourceTree_device_not_configured.txt
SourceTree: Device not configured (on MacOS)
In console:
git config credential.helper
You will see: osxkeychain
git config --global credential.helper sourcetree
Then if you perform git config credential.helper again
You will see: sourcetree
@pauloantonelli
pauloantonelli / utpl_download.sh
Last active October 7, 2022 15:43 — forked from jpallari/utpl_download.sh
Script that downloads Youtube playlist and extracts the audio from the downloaded clips.
#!/bin/bash
youtube-dl --rm-cache-dir --cookies ./youtube.com_cookies.txt --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist 'https://youtube.com/playlist?list=PL14877460D389BBFA'
@pauloantonelli
pauloantonelli / pre-build.sh
Created March 8, 2022 12:58 — forked from evelyne24/pre-build.sh
Bash script to extract the build name and number from `pubspec.yaml` before building your Flutter app
#!/bin/bash
set -e
file=$(cat pubspec.yaml)
BUILD_NAME=$(echo $file | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p')
BUILD_NUMBER=$(git rev-list HEAD --count)
@pauloantonelli
pauloantonelli / dart-clean-arch-vscode-snippets.json
Created February 23, 2022 14:46
dart clean arch layers vscode snippets
{
// Domain
// Repository
"Dart Clean Arch - Repository Interface Type: Set": {
"prefix": ["repository-interface-set"],
"body": [
"abstract class I${1:RuleName}Repository {\t$0",
" Future<Either<${1:RuleName}RepositoryError, ${2:T}>> call(${3:T} param);",
"}\t$0"
],
@pauloantonelli
pauloantonelli / usefull-tool-for-macOs.md
Last active December 13, 2023 12:46
usefull tool for macOs
@pauloantonelli
pauloantonelli / validators
Created February 12, 2022 12:21
Usefull validators for dart
class Validators {
static bool validateEmail(String value) {
if (value.isEmpty) return false;
final String pattern =
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
final regex = RegExp(pattern);
final result = regex.hasMatch(value);
return result;
}
@pauloantonelli
pauloantonelli / either.dart
Last active February 26, 2023 03:59
dart Either
abstract class IGlobalFailure implements Exception {
final String? message;
IGlobalFailure({this.message});
}
abstract class EitherFailure implements Exception {
final String? message;
EitherFailure({this.message});
}
@pauloantonelli
pauloantonelli / onesingal.service.ts
Created September 29, 2020 01:12 — forked from PsyGik/onesingal.service.ts
OneSignal Angular TypeScript
import {Injectable} from '@angular/core';
import {Cache} from '../utils/storage.provider'; // Decorator to access local storage
let OneSignal;
const url = '';
@Injectable()
export class OneSignalService {
@Cache({pool: 'OneSignal'}) oneSignalInit; // to check if OneSignal is already initialized.
@pauloantonelli
pauloantonelli / infinite-scroll.directive.ts
Created June 19, 2020 00:08 — forked from gangadharjannu/infinite-scroll.directive.ts
This is an Angular 2 infinite scroll directive. It is simple, easy to use and very CPU-efficient.
// USAGE:
//
// When you attach the infiniteScroll directive to an element, it will emit the infiniteScrollAction
// @Output() event every time the user has scrolled to the bottom of the element. Your loadMoreArticles
// function can make an HTTP call and append the results to the articles list, for example. In doing this,
// you effectively increase the height of the element and thus begin the process of the infiniteScroll directive
// again, over and over until the element height stops increasing.
//
// <div class="container" infiniteScroll (infiniteScrollAction)="loadMoreArticles()">
// <div class="article" *ngFor="let article of articles">