Skip to content

Instantly share code, notes, and snippets.

View dexfs's full-sized avatar
🎯
Focusing on support my children

André Santos dexfs

🎯
Focusing on support my children
View GitHub Profile
import {
ArgumentMetadata,
BadRequestException,
PipeTransform,
ValidationPipe,
} from '@nestjs/common';
import { Product1, Product2 } from './dtos/create-product.dto';
import { plainToInstance } from 'class-transformer';
import { validate } from 'class-validator';
// not iterable
{
const myItem = {
a: 1,
b: 2
}
// const r = [...myItem] // TypeError: myItem is not iterable
}
// now object is iterable
@dexfs
dexfs / mockData.js
Last active April 7, 2021 23:52
Utilizando cloneDeep pois o javascript utliza shallow copy (copiando apenas o primeiro nível do objeto), spread e Object.assign() fazem dessa forma, o que tiver nested é passado por referência.
module.exports = {
name: "name",
nested: {
email: 'user@domain.com.br',
name: 'fulano de tal',
},
}
const amqpMock = require('amqplib-mocks')
module.exports = amqpMock
[color]
ui = true
[core]
editor = vim
excludesfile = /Users/andresantos/.gitignore
autocrlf = input
[alias]
aliases = config --get-regexp alias
br = branch
ca = commit -v -a
@dexfs
dexfs / app.js
Created August 28, 2018 15:28 — forked from pantharshit00/app.js
Simple express app using JWT authentication
/**
* To get started install
* express bodyparser jsonwebtoken express-jwt
* via npm
* command :-
* npm install express bodyparser jsonwebtoken express-jwt --save
*/
// Bringing all the dependencies in
const express = require('express');
@dexfs
dexfs / bookshelf-transaction-test.js
Created August 27, 2018 15:56 — forked from jeffsoup/bookshelf-transaction-test.js
Small Example of A Bookshelf Transaction
import config from '../src/config'
import chai, { expect, should, assert } from 'chai'
import _ from 'lodash'
const knex = require('knex')(config.database)
const bookshelf = require('bookshelf')(knex)
const Test = bookshelf.Model.extend({
tableName: 'TEST_ONLY',
idAttribute: 'ID',

#DELETE BRANCHES MERGED INTO CURRENT BRANCH

git branch --merged | egrep -v "(^\*|master|dev|develop)" | xargs git branch -d

How to list only the file names that changed between two commits?

git diff --name-only SHA1 SHA2

where you only need to include enough of the SHA to identify the commits. You can also do, for example

Docker Containers
Create an interactive terminal container with a name, an image, and a default command:
Usage: docker create -it --name=<name> <image> <command>
Example: docker create -it --name=foo ubuntu bash
List all running containers:
foreach($arquivos as $arquivo)
{
if(!in_array($arquivo->getFileName(), $excludeNotDir) &&
!in_array($arquivo->getExtension(), $excludeExtension) &&
!$arquivo->isDir())
{
array_push($files, array('arquivo' => $arquivo->getFileName()));
}
}