Skip to content

Instantly share code, notes, and snippets.

View carlosazaustre's full-sized avatar

Carlos Azaustre carlosazaustre

View GitHub Profile
@carlosazaustre
carlosazaustre / db.js
Created October 23, 2020 15:09
Get Data from nested collection on Firestore
// Database format: /products/{productId}/prices/{priceId}
export async function getProductPricesById(id) {
const prices = []
const snapshot = await DataSource.collection('products')
.doc(id)
.collection('prices')
.get()
snapshot.forEach((doc) => {
@carlosazaustre
carlosazaustre / index.js
Created February 28, 2023 11:20
Asincronía en JavaScript
const data = [
{
title: "Aprendiendo JavaScript",
year: "2021",
isbn: "978-87001179623",
author: "Carlos Azaustre",
},
{
title: "Aprendiendo React",
year: "2023",
const logo = document.getElementById("logo");
let currentIndex = 0;
const keySequence = [
"ArrowUp",
"ArrowUp",
"ArrowDown",
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowLeft",
@carlosazaustre
carlosazaustre / App.jsx
Created April 13, 2023 09:27
ErrorBoundary Example
import { Suspense, lazy } from "react";
import { ErrorBoundary, ErrorMessage } from "./Counter";
import "./App.css";
const Counter = lazy(() => import("./Counter"));
function App() {
return (
<div className="App">
<Suspense fallback={<p>Loading...</p>}>
@carlosazaustre
carlosazaustre / toReversed.js
Created May 16, 2023 09:36
Nuevos métodos Inmutables en JavaScript para 2023
// 3. toReversed
const studentGrades = [90, 88, 98, 61, 78, 62, 64];
// modifica el array original
studentGrades.reverse(); // [ 61, 62, 64, 78, 88, 90, 98 ]
const newStudentGrades = [90, 88, 98, 61, 78, 62, 64];
// Immutabilidad! Devuelve un nuevo array sin modificar el original
newStudentGrades.toReversed();