Skip to content

Instantly share code, notes, and snippets.

Gesiel Rosa gesielrosa

View GitHub Profile
@gesielrosa
gesielrosa / makeZodI18nMap.ts
Last active September 24, 2025 14:05
Zod → next-intl Error Map
import { TranslationValues, useTranslations } from 'next-intl';
import { ZodErrorMap, ZodIssueCode, ZodParsedType, defaultErrorMap } from 'zod';
const jsonStringifyReplacer = (_: string, value: any): any => {
if (typeof value === 'bigint') {
return value.toString();
}
return value;
};
* A detailed table that maps story points to T-shirt sizes and kitchen tasks.
* Clear explanations on why tasks are assigned specific story points.
* Insights on how these everyday analogies can clarify the principles of task estimation in agile environments.
Story Points | Development Task Description | Kitchen Task Example | T-Shirt Size
-------------|---------------------------------------|------------------------------|:--------------:
0 Points | No effort; no business value. | Washing a single spoon. | N/A
1 Point | Easy; understood; completed quickly. | Making a sandwich. | XS
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 November 5, 2025 09:21
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'