Skip to content

Instantly share code, notes, and snippets.

View gesielrosa's full-sized avatar
👾
contact@gesiel.com

Gesiel Rosa gesielrosa

👾
contact@gesiel.com
View GitHub Profile
FROM node:12.22-alpine3.15 AS build
WORKDIR /app/acvali-backoffice
RUN npm cache clean --force
COPY . .
RUN npm install --legacy-peer-deps
RUN npm run build:prod -- --base-href /backoffice/
@gesielrosa
gesielrosa / Dockerfile
Last active April 16, 2023 16:08
Dockerfile to build Java/Maven application and run on a Tomcat webservice
ARG APP_NAME=aplication-name
FROM maven:3.6.1-jdk-8-alpine as build-env
COPY pom.xml /tmp/
COPY src /tmp/src/
WORKDIR /tmp/
RUN mvn package
@gesielrosa
gesielrosa / emulator-log.command
Created March 1, 2023 17:02
[MACOS] Open Logcat and filter by text
read -p "Enter the log filter: " filter
echo ""
echo "[Logging to '$filter']"
echo ""
adb logcat | grep $filter
@gesielrosa
gesielrosa / run-emulator.command
Last active March 3, 2023 19:58
[MACOS] Open Android Emulator
if [ -z "$ANDROID_SDK_ROOT" ]; then
echo "ANDROID_SDK_ROOT is not set"
exit 1
fi
cd $ANDROID_SDK_ROOT/emulator
echo ""
echo "[Available devices]"
./emulator -list-avds
@gesielrosa
gesielrosa / track-by-key.pipe.ts
Last active July 4, 2022 18:08
Track by pipe for Angular
import {NgModule, Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'trackByKey',
pure: true,
})
export class TrackByKeyPipe implements PipeTransform {
public transform(key: string) {
return (index, value) => {
return value[key];
import { ErrorHandler, Inject, Injectable, InjectionToken } from '@angular/core';
import {
HTTP_INTERCEPTORS,
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest
} from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
/**
* Used to guarantee an error-free conversion of a string to JSON object.
* @param str: string
* @return any
*/
export function safeJSONParse(str: string): any {
try {
return JSON.parse(str);
} catch (_) {
return null;
@gesielrosa
gesielrosa / angular-facebook-pixel.service.ts
Last active December 1, 2020 22:46
Service to add Facebook Pixel event track to Angular application
import { Injectable, OnDestroy } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { environment } from '@env/environment';
declare let fbq: Function;
@Injectable({
providedIn: 'root'