View useLocalStorage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
const useLocalStorage = (key, initialValue) => { | |
// State to store our value | |
// Pass initial state function to useState so logic is only executed once | |
const [storedValue, setStoredValue] = useState(() => { | |
if (typeof window === "undefined") { | |
return initialValue; | |
} | |
try { |
View filter.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform, Injectable } from '@angular/core'; | |
@Pipe({ | |
name: 'filter' | |
}) | |
@Injectable() | |
export class FilterPipe implements PipeTransform { | |
transform(items: any, filter: any, defaultFilter: boolean = true): any { | |
if (!filter) { | |
return items; |
View countries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const countries = [ | |
"Ecuador", | |
"Afganistan", | |
"Albania", | |
"Alemania", | |
"Andorra", | |
"Angola", | |
"Antartida", | |
"Antigua y Barbuda", | |
"Arabia Saudi", |
View error-interceptor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AuthService } from './../services/auth.service'; | |
import { Injectable } from '@angular/core'; | |
import { | |
HttpRequest, | |
HttpHandler, |
View Factura-Preview.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Carbon\Carbon; | |
use DOMDocument; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
use RobRichards\XMLSecLibs\XMLSecurityDSig; | |
use RobRichards\XMLSecLibs\XMLSecurityKey; |
View validarCedula.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function cedulaValida(cedula: string): boolean { | |
if (cedula.length != 10) return false; | |
// Digitos de provincia (2 primeros) | |
const digitos_provincia = cedula.substring(0, 2); | |
// Deben estar entre 1 y 24. | |
if (parseInt(digitos_provincia) < 1 || parseInt(digitos_provincia) > 24) | |
return false; | |
// Coeficientes de validación (en posiciones pares) | |
const coeficientes = [2, 1, 2, 1, 2, 1, 2, 1, 2]; | |
// Obtener la suma de multiplicar los dígitos por su respectivo coeficiente, si el resultado es mayor que 9, se resta 9. |
View create_angular_project.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ng new pickup-client -S --commit=true --inline-style=false --inline-template=false --minimal=true --routing=true --style=scss |
View functions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function validarCedula(cedula: string | any) { | |
let total = 0; | |
const longitud = cedula.length; | |
const longcheck = longitud - 1; | |
if (cedula !== "" && longitud === 10) { | |
for (let i = 0; i < longcheck; i++) { | |
if (i % 2 === 0) { | |
let aux = cedula.charAt(i) * 2; | |
if (aux > 9) { |