Skip to content

Instantly share code, notes, and snippets.

View StalinMazaEpn's full-sized avatar
💻
Improving Skills and Knowledge

Stalin StalinMazaEpn

💻
Improving Skills and Knowledge
View GitHub Profile
@StalinMazaEpn
StalinMazaEpn / AngularHelpers
Last active August 3, 2024 21:25
AngularHelpers
import { Directive, OnDestroy, OnInit } from "@angular/core";
import { Calendar } from "primeng/calendar";
import { Subject, fromEvent, merge, takeUntil, timer } from "rxjs";
@Directive({
selector: 'p-calendar[ng-calendar-year]'
})
export class NgPrimeCalendarYearDirective implements OnInit, OnDestroy {
maxDateYear: number | null = null;
@StalinMazaEpn
StalinMazaEpn / bashShortcuts
Created August 3, 2024 04:02
bashShortcuts
@ECHO OFF
set FIREBASE_AUTH_EMULATOR_HOST=localhost:9099
set GCLOUD_PROJECT=handytec-webpage-test
START cmd /k "echo Hello %FIREBASE_AUTH_EMULATOR_HOST%! %GCLOUD_PROJECT%! && firebase emulators:start --import=./emulators.backup"
TIMEOUT /t 15
START cmd /k "echo Hello %FIREBASE_AUTH_EMULATOR_HOST%! %GCLOUD_PROJECT%! && gradlew build && java -jar build/libs/app.jar"
EXIT
@StalinMazaEpn
StalinMazaEpn / validationsJavascript
Created August 3, 2024 04:01
validationsJavascript
```js
export function validateCorporativeEmail(control: AbstractControl) {
const valueEmail: string | null = control.value;
const emailToVerify = valueEmail ||'';
const emailDomain = emailToVerify.substring(emailToVerify.indexOf("@") + 1, emailToVerify.lastIndexOf("."));
if (emailToVerify === '' || ["gmail", "outlook", "hotmail", "yahoo", "icloud", "aol", "live", "msn", "yopmail", "mail"].includes(emailDomain)) {
return { invalidCorporativeEmail: true };
}
return null;
}
@StalinMazaEpn
StalinMazaEpn / iosApple
Last active August 3, 2024 03:59
iosApple
## Install NVM on macOS
brew install nvm
mkdir ~/.nvm
Edit your shell config file to add the path to the NVM home directory. The shell config file would be ~/.bash_profile if you are using Bash, or ~./zshrc if you are using Zsh, the default shell for MacOS Catalina and later versions.
# open config file
nano ~/.zshrc
# add the nvm path
export NVM_DIR="$HOME/.nvm"
@StalinMazaEpn
StalinMazaEpn / dockerShortcuts
Last active August 3, 2024 21:20
DockerShortcuts
## Database connection
mysql://host.docker.internal:3306
# Run MySQL on Docker
docker run --net=host --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=MYSQL_ROOT_PASSWORD=12345 -p 3306:3306 --volume=/var/lib/mysql:/var/lib/mysql:rw --detach --name=smdev mysql
## Build Image and run it
docker build -t portalbackv2 .
docker run --name imageportalbackv2 -p 8080:8080 portalbackv2
@StalinMazaEpn
StalinMazaEpn / mysqlShortcuts
Last active August 3, 2024 04:03
MYSQL Shortcuts
## Filter by month, year or day
YEAR(usageDate) = 2023
MONTH(usageDate) = 12
# Manage JSON
SELECT JSON_OBJECTAGG(notificationTemplateType, true)
FROM (SELECT DISTINCT notificationTemplateType FROM APP_NOTIFICATION_TEMPLATE) AS unique_notification_types;
@StalinMazaEpn
StalinMazaEpn / sample-basic-page.html
Created May 15, 2024 18:14
Página Básica HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Microsoft Azure App Service - Welcome</title>
<link rel="shortcut icon" href="https://appservice.azureedge.net/images/app-service/v4/favicon.ico"
type="image/x-icon" />
@StalinMazaEpn
StalinMazaEpn / keybindings.json
Created January 13, 2021 04:49
Vscode Keybindings
// Coloque sus atajos de teclado en este archivo para sobreescribir los valores predeterminadosauto[]
[
{
"key": "ctrl+k ctrl+s",
"command": "-workbench.action.openGlobalKeybindings"
},
{
"key": "ctrl+numpad_divide",
"command": "editor.action.commentLine",
"when": "editorTextFocus && !editorReadonly"
// This function converts the byte to the corresponding amount, be it kilo, mega, GB, etc.
const convertWeightByte = (byte) => {
let sizekiloByte = (byte / 1024);
let sizeMega = (sizekiloByte / 1024);
let sizeGigabyte = (sizeMega / 1024);
let sizeTerabyte = (sizeGigabyte / 1024);
let sizePetabyte = (sizeTerabyte / 1024);
let sizeExabyte = (sizePetabyte / 1024);
if(sizekiloByte > 0 && sizekiloByte <= 1024){
@StalinMazaEpn
StalinMazaEpn / checkbox.validator.ts
Created May 30, 2020 23:37
Checkbox Validator Angular
import { FormControl } from '@angular/forms';
export class CheckboxValidator{
static isChecked(control: FormControl) : any{
if(control.value != true){
return {
"notChecked" : true
};