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
// filter out unnecessary key-value pairs | |
const omit = (obj, arr) => | |
Object.keys(obj) | |
.filter(k => !arr.includes(k)) | |
.reduce((acc, key) => ((acc[key] = obj[key]), acc), {}); | |
let item = {name: 'John Doe', profession: 'Developer', age: 30, gender: 'male', height: '1.6m', weight: '80kg', country: 'UK'}; | |
let filteredItem = omit(item, ['gender', 'height', 'weight', 'country']); | |
// console.log(filteredItem); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.loader { | |
background-color: #000; | |
position: absolute; | |
height: 4rem; | |
width: 4rem; | |
left: 50%; |
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
Refer to doc here <a href="https://firebase.google.com/docs/functions/config-env">Config Env. Setup</a> | |
# Set environment configuration for your project | |
``` | |
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID" | |
``` | |
# Retrieve current environment configuration | |
``` | |
firebase functions:config:get |
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
// Define new date, result | |
let d = new Date(), result; | |
// Set new date | |
d.setDate(d.getDate() + 20); | |
// Return result | |
result = ('0' + d.getDate()).slice(-2) + '/' + ('0' + (d.getMonth()+1)).slice(-2) + '/' + d.getFullYear(); | |
Explanation: | |
.slice(-2) returns the last 2 characters of the string. |
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
'use strict'; | |
// Import packages | |
import admin from 'firebase-admin'; | |
const FieldValue = admin.firestore.FieldValue; | |
// Add credential service account details | |
import serviceAccount from ".path-to-file.json"; | |
// Initialize firebase admin sdk config |
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
Setup a POST => request; | |
Replace firebase api key in the url => "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key={FIREBASE_API_KEY}" | |
Pass the following params in the body of the request | |
{ | |
"email": "<email>", | |
"password": "<password>", | |
"returnSecureToken": true | |
} |
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
<template> | |
<div class="body--wrapper" :class="{ active: !slide && !width }"> | |
<Header"></Header> | |
<div class="container"> | |
<router-view :key="$route.path"/> | |
</div> | |
</div> | |
</template> | |
<script lang="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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> | |
How to insert spaces/tabs in text using HTML/CSS? | |
</title> | |
</head> | |
<body> | |
<h1 style="color: green">GeeksforGeeks</h1> | |
<b>How to insert spaces/tabs in text using HTML/CSS?</b> |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.7.0 <0.9.0; | |
/** | |
* @title Storage | |
* @dev Store & retrieve value in a variable | |
*/ | |
contract Array { |
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 logo from "./logo.svg"; | |
import "./App.css"; | |
import { useState } from "react"; | |
function App() { | |
const [food, setFood] = useState("dumpling"); | |
return ( | |
<div className="App"> | |
<input |
OlderNewer