Skip to content

Instantly share code, notes, and snippets.

View renzo4web's full-sized avatar
๐Ÿ› ๏ธ
born to build

Renzo renzo4web

๐Ÿ› ๏ธ
born to build
View GitHub Profile
@renzo4web
renzo4web / firebase-example.ts
Created May 30, 2023 10:37
This code showcases how to use the Firebase SDK v9 with Firestore. It demonstrates accessing a specific document, performing a query, updating a document, and listening for changes in the database using a snapshot listener
import { initializeApp } from 'firebase/app';
import { getFirestore, collection, doc, getDoc, query, where, updateDoc, onSnapshot } from 'firebase/firestore';
// Firebase configuration
const firebaseConfig = {
// Your Firebase configuration here
};
// Initialize Firebase app
const app = initializeApp(firebaseConfig);
@renzo4web
renzo4web / methodByReduce.js
Last active August 13, 2021 14:26
Popular Javascript array method made with reduce
// Most Used Array methods made fropm reduce()
const emojis = [
'โœŒ',
'๐Ÿ˜‚',
'๐Ÿ˜',
'โœŒ',
'๐Ÿ˜',
'๐Ÿ˜ฑ',
'๐Ÿ‘‰',
@renzo4web
renzo4web / countRepeated.js
Last active May 20, 2021 18:53
Count repeated values with reduce
const letters = ['a','b',"A",'a','b','c']
const sum = letters.reduce((acc,char)=>{
// Check the property, if exist sum one , if not create with value 1.
acc[char] = acc[char] + 1 || 1
return acc
},{})
console.log(sum) // {a: 2, b: 2, A: 1, c: 1}
@renzo4web
renzo4web / css
Last active August 13, 2021 14:50
Responsive layout grid one line
.parent {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
grid-gap : 1em;
}
.children {
background-color : green;
width : 200px;
height : 200px;