Skip to content

Instantly share code, notes, and snippets.

View jlaguilargomez's full-sized avatar
👨‍💻
Learning

Jose Luis Aguilar jlaguilargomez

👨‍💻
Learning
View GitHub Profile

Firebase Setup For House Marketplace

  1. Create Firebase Project
  2. Create "web" app within firebase to get config values"
  3. Install firebase in your project "npm i firebase
  4. Create a config file in your project
  5. Add authentication for email/password and Google
  6. Create a user from Firebase
  7. Enable Firestore
  8. Add rules for firestore
@jlaguilargomez
jlaguilargomez / paginator.js
Created March 15, 2021 07:35
Implement recursivity to create a group of elements with N length from an original Array
const arr = [1, 2, 3, 4, 5, 6];
let newArr = [];
const spliceArray = (originalArr, newArr, groupLength) => {
newArr.push(originalArr.splice(0, groupLength));
return originalArr.length === 0
? newArr
: spliceArray(originalArr, newArr, groupLength);
};
@jlaguilargomez
jlaguilargomez / manage-documents.utils.ts
Created January 20, 2021 17:17
Manage document utils: download and previsualize-pdf
/**
* Download document into desktop
* @param base64 Document in base64 format
* @param documentName Document Name
*/
export function downloadPDF(base64: string, documentName: string) {
const documentType = getDocumentType(base64);
const linkSource = `data:${documentType};base64,${base64}`;
const downloadLink = document.createElement('a');
const fileName = documentName;
@jlaguilargomez
jlaguilargomez / validateNIF.js
Created November 20, 2020 11:52
Validate NIF / DNI
function validateNIF(nif:string){
const digitRegex:RegExp = new RegExp(/\d+/);
const letterRegex:RegExp = new RegExp(/[A-Z]/);
const nifRegex: RegExp = new RegExp(/^\d{8}[a-zA-Z]$/);
const letters = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E', 'T'];
// ** Check if NIF has the correct format
if(!nifRegex.test(nif)){
return false;
@jlaguilargomez
jlaguilargomez / form.scss
Created June 19, 2020 06:49
Formulario con etiqueta móvil "onClick"
.c-form {
.ui-inputtext {
width: 100%;
}
.ui-dropdown .ui-dropdown-panel {
min-width: 100%;
width: max-content;
}
@jlaguilargomez
jlaguilargomez / disable-selection.scss
Last active April 26, 2020 07:12
[CSS] Disable selection
.u-no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@jlaguilargomez
jlaguilargomez / disable-touch.scss
Last active June 11, 2023 16:04
(CSS) Disable touch effect on mobile
.u-disable-touch {
// -webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent;
}
@jlaguilargomez
jlaguilargomez / _base.scss
Created April 8, 2020 16:36
Generar un estilo base para el documento
*,
*::after,
*::before {
margin: 0;
padding: 0;
/* Hereda del body la propiedad */
box-sizing: inherit;
}
html {
@jlaguilargomez
jlaguilargomez / navButton.scss
Created April 7, 2020 14:40
NavButton with animation
.navigation {
&__checkbox {
display: none;
}
&__button {
display: flex;
align-items: center;
justify-content: center;
width: 64px;
height: 100%;
@jlaguilargomez
jlaguilargomez / script-plus-node.js
Last active March 24, 2020 07:26
Script to improve the "ng server" performance increasing the dedicated memory to Node
"nghm": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng serve"