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
main{ | |
display: flex; | |
min-height: 100vh; | |
justify-content: center; | |
flex-direction: column; | |
background-color: #282c34; | |
padding: 10px 500px; |
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> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
.container { | |
position: relative; | |
} |
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
/* Extra small devices (phones, 600px and down) */ | |
@media only screen and (max-width: 600px) {...} | |
/* Small devices (portrait tablets and large phones, 600px and up) */ | |
@media only screen and (min-width: 600px) {...} | |
/* Medium devices (landscape tablets, 768px and up) */ | |
@media only screen and (min-width: 768px) {...} | |
/* Large devices (laptops/desktops, 992px and up) */ |
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 React from "react"; | |
import ReactDOM from "react-dom"; | |
const brands = ["Dell", "Huawei", "Samsung", "RedMi", "Apple"]; | |
const BrandList = () => ( | |
<div> | |
<ul>{brands.map(brand => <li key={brand}> {brand} </li>)}</ul> | |
</div> | |
); |
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
const permutations = arr => { | |
if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr; | |
return arr.reduce( | |
(acc, item, i) => | |
acc.concat( | |
permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val => [ | |
item, | |
...val, | |
]) | |
), |
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
const $ = document.querySelector.bind(document); | |
const $$ = document.querySelectorAll.bind(document); | |
const mainContent = $('.main-content'); | |
const externalLinks = $$('a[target="_blank"]'); |
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
const zoo = { | |
lion: '🦁', | |
panda: '🐼', | |
}; | |
Object.keys(zoo); | |
// ['lion', 'panda'] | |
Object.values(zoo); | |
// ['🦁', '🐼'] |
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
{ | |
"adverts": [ | |
{ | |
"company": "Econet", | |
"heading": "Kevin Kruse", | |
"promo": "39%", | |
"link": "https://gist.github.com", | |
"social": "https://gist.github.com", | |
"image": "https://i.ibb.co/rFKZHFn/frank-mckenna-Eg-B1u-SU5t-RA-unsplash.jpg" | |
}, |
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
const date = new Date(); | |
// ✅ Get a string according to a provided Time zone | |
console.log( | |
date.toLocaleString('en-US', { | |
timeZone: 'America/Los_Angeles', | |
}), | |
); // 👉️ "1/15/2022, 11:54:44 PM" | |
console.log( |
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
const array = [ | |
{ id: 1, name: 'a1', sub: { id: 6, name: 'a1 sub' } }, | |
{ id: 2, name: 'a2', sub: null }, | |
{ id: 3, name: 'a3', sub: { id: 8, name: 'a3 sub' } }, | |
{ id: 4, name: 'a4', sub: null }, | |
{ id: 5, name: 'a5', sub: { id: 10, name: 'a5 sub' } }, | |
]; | |
const anotherArray = [ | |
{ id: 1, name: 'a1', sub: { id: 6, name: 'a1 sub' } }, |
OlderNewer