This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get.bottomSheet( | |
SingleChildScrollView( | |
child: Container( | |
decoration: BoxDecoration( | |
color: Colors.white, | |
borderRadius: BorderRadius.only( | |
topLeft: Radius.circular(10), | |
topRight: Radius.circular(10), | |
), | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomAppBar extends PreferredSize { | |
@override | |
Size get preferredSize => Size.fromHeight(50); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
height: preferredSize.height, | |
color: Colors.white, | |
alignment: Alignment.center, | |
child: SafeArea( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:dartz/dartz.dart'; | |
class EitherExample { | |
Future<Either<Failure, Entity>> handle() async { | |
try{ | |
Entity entity = new Entity() | |
if(entity.document == null) throw Exception("Document is null"); | |
return Right(entity); | |
}catch(error){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:equatable/equatable.dart'; | |
import 'package:meta/meta.dart'; | |
class UserEntity extends Equatable { | |
final String id; | |
final String username; | |
final String password; | |
final List<LinkEntity> links; | |
UserEntity({ | |
@required this.id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The returned ID can be passed on image field on model | |
const uploadFileBinary = async (binary, uuid) => { | |
const fileInfo = { name: uuid } | |
const metas = {} | |
const { optimize } = strapi.plugins.upload.services['image-manipulation']; | |
const { buffer, info } = await optimize(binary); | |
const formattedFile = await strapi.plugins.upload.services.upload.formatFileInfo( | |
{ | |
filename: uuid + '.png', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) check if is everything ok on local machine using docker-compose | |
docker-compose up | |
# 2) run aws configure and set your credentials | |
aws configute | |
# or import your csv configuration | |
aws configure import --csv file://$PDW/aws-profile-credentials.csv | |
# 3) check if your credentials is currecly imported and configured | |
aws configure list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#instala uma imagem mysql na versão 5.7 atribuindo um volume existente | |
docker run -d --name mysql --restart always -p 3306:3306 -v mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=mysql-secret-pw mysql:5.7 --default-authentication-plugin "mysql_native_password" | |
#instala uma imagem redis na versão alpine atribuindo um volume existente | |
docker run -d --name redis --restart always -p 6379:6379 -v redis-volume:/var/lib/redis redis:alpine redis-server --requirepass "redis-secret-pw" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IMPORT DEPENDENCIES | |
const stream = require("stream") | |
const AWS = require('aws-sdk'); | |
const fs = require('fs'); | |
const s3 = new AWS.S3(); | |
// DOWNLOAD STREAM EXAMPLE | |
const s3download = (bucketName, keyName, localDest) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { writeFile, readFile } from "fs/promises" | |
export const save = async (data) => { | |
const currentData = await read("./../database.json") | |
currentData.push(data) | |
await writeFile(databaseFile, JSON.stringify(currentData)) | |
} | |
export const read = async (filename) => { | |
const { pathname: databaseFile } = new URL(filename, import.meta.url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const language = "pt-BR" | |
// formatting lists | |
const vehicles = ["Car", "Bike", "Airplan"] | |
new Intl.ListFormat(language, { style: "long", type: "conjunction" }).format(vehicles) | |
// formatting units | |
const kmTraveled = 10000 | |
new Intl.NumberFormat(language, { style: "unit", unit: "kilometer" }).format(kmTraveled) |
OlderNewer