Skip to content

Instantly share code, notes, and snippets.

View theusindabike's full-sized avatar

Matheus Lopes theusindabike

View GitHub Profile
@theusindabike
theusindabike / .bashrc
Last active January 8, 2024 18:37
useful .bashrc example
# Flutter (FVM)
FLUTTER_HOME="$HOME/fvm/versions/3.10.1/bin"
export PATH=$PATH:$FLUTTER_HOME/bin
# Android SDK
export ANDROID_HOME=$HOME/Android/Sdk
# Android Tools
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
@theusindabike
theusindabike / badges_config.json
Created June 30, 2023 19:05
badges_config.json
{
"schemaVersion": 1,
"label": "Hello",
"message": "World",
"color": "orange"
}
@theusindabike
theusindabike / mock-fs-example.ts
Created May 23, 2023 19:53
using mock-fs to create a text file
it('throws error if class-validator return error', async () => {
mockfs({
'test_dir/assets': {
'sales_sample.txt': mockfs.file({
content:
'2022-01-15T19:20:30-03:00CURSO DE BEM-ESTAR 0000012750JOSE CARLOS\n12021-12-03T11:46:02-03:00DOMINANDO INVESTIMENTOS 0000050000MARIA CANDIDA',
}),
},
});
const file = fs.readFileSync('test_dir/assets/sales_sample.txt');
@theusindabike
theusindabike / transactions.e2e-spec.ts
Last active May 23, 2023 19:55
override datasource provider to use pg-mem
import * as request from 'supertest';
import { Test } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { setupDatabase } from '../setup-database';
import { AppModule } from '../../src/app.module';
import { TransactionRepository } from '../../src/transactions/repository/transactions.repository';
describe('TransactionController (e2e)', () => {
let app: INestApplication;
@theusindabike
theusindabike / setup-database.ts
Last active May 23, 2023 19:45
peg-mem datasource configuration
import { newDb } from 'pg-mem';
export const setupDatabase = async () => {
const db = newDb();
db.public.registerFunction({
implementation: () => 'test',
name: 'current_database',
});
@theusindabike
theusindabike / settings.json
Created May 1, 2023 14:58
.vscode/settings.json
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}