This file contains hidden or 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
@mixin responsive-font($responsive, $min, $max: false, $fallback: false) { | |
$responsive-unitless: $responsive / ($responsive - $responsive + 1); | |
$dimension: if(unit($responsive) == 'vh', 'height', 'width'); | |
$min-breakpoint: $min / $responsive-unitless * 100; | |
@media (max-#{$dimension}: #{$min-breakpoint}) { | |
font-size: $min; | |
} | |
@if $max { |
This file contains hidden or 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 wait = async (time) => { | |
return new Promise((resolve) => { | |
setTimeout(resolve, time); | |
}); | |
} | |
const waitInMs = 1000; | |
let isLoading = true; | |
let value = 1; | |
console.log(`value in the first iteration: ${value}`); |
This file contains hidden or 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
// Instead of converting string to boolean | |
const isRetention = localStorage.getItem('is_retention') === 'true'; | |
// Parsing the JSON is better solution | |
const isRetention = JSON.parse(localStorage.getItem('is_retention')); | |
// Or create a helper function to parse the item | |
const getLocalStorageItem = item => JSON.parse(localStorage.getItem(item)); | |
const isRetention = getLocalStorageItem('is_retention'); |
This file contains hidden or 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
// A | |
const newUser = { | |
id: 4, | |
name: "Denomer Crazy", | |
username: "crazy.1", | |
email: "[email protected]", | |
phone: "", | |
website: "crazy.app", | |
password: "crazed_checker" | |
}; |
This file contains hidden or 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
<ul class="my-list"> | |
<li class="my-list__list-item">First item</li> | |
<li class="my-list__list-item">Second item</li> | |
<li class="my-list__list-item my-list__list-item--center">Third item</li> | |
</ul> |
This file contains hidden or 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
var loadScript = (src, callback) => { | |
var script = document.createElement('script'); | |
script.src = src; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
script.onload = callback; | |
} | |
(function() { | |
loadScript('firstScript.js', function() { | |
console.log('First script loaded!'); |
This file contains hidden or 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
function makeRobot(name, job) { | |
return { | |
name: name, | |
job: job, | |
introduce: function() { | |
console.log(`Hi! I'm ${this.name}. My job is ${this.job}.`); | |
}, | |
}; | |
} |
This file contains hidden or 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
$ brew search node | |
$ brew install node | |
$ brew install node@8 | |
$ brew unlink node@8 | |
$ brew link --force --overwrite node@8 | |
$ node --version |
This file contains hidden or 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
// 1: Deep copy using iteration | |
const iterationCopy = (src) => { | |
let target = {}; | |
for (let prop in src) { | |
if (src.hasOwnProperty(prop)) { | |
target[prop] = src[prop]; | |
} | |
} | |
return target; | |
} |