Skip to content

Instantly share code, notes, and snippets.

View guiworks's full-sized avatar

Guilherme Macedo guiworks

View GitHub Profile
@carlitomurta
carlitomurta / cpfCnpj.pipe.ts
Created November 22, 2019 14:14
Pipe Angular para CPF ou CNPJ
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'cpfCnpj'
})
export class CpfCnpjPipe implements PipeTransform {
transform(value: string, args?: any): any {
if (value) {
value = value.replace(/\D/g, '');
@remarkablemark
remarkablemark / README.md
Last active November 14, 2023 08:55
How to mock `window.location.reload` in Jest and jsdom: https://remarkablemark.org/blog/2018/11/17/mock-window-location/
@praveenpuglia
praveenpuglia / same-effect-multiple-actions.ts
Created April 25, 2018 19:04
Same effect for multiple actions - ngrx effects
@Effect({dispatch: false})
entityCreationSuccess$: Observable<Action> = this.actions$.pipe(
ofType(UserActions.CREATE_USER_SUCCESS, PostActions.CREATE_POST_SUCCESS),
tap(action => {
this.router.navigate(['../'], {relativeTo: this.route})
})
);