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
// ❌ Before | |
function getErrorMessage(error) { | |
if(error === 'username') { | |
return `Username is required` | |
} else if (error === 'email') { | |
return `Don't forget your email!` | |
} else if (error === 'password') { | |
return `Please enter your password` | |
} | |
} |
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 body = document.body; | |
let timer; | |
window.addEventListener('scroll', function() { | |
clearTimeout(timer); | |
if (!body.classList.contains('disable-hover')) { | |
body.classList.add('disable-hover') | |
} | |
timer = setTimeout(function(){ |
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
/** | |
* Stop animations and transitions | |
* on window resize | |
* | |
* @type {Function} | |
*/ | |
let resizeTimer; | |
window.addEventListener('resize', () => { | |
document.body.classList.add('resize-animation-stopper'); | |
clearTimeout(resizeTimer); |
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
/* Headers out of order (i.e. h2 before h1, etc.) | |
Result: dotted blue outline | |
*/ | |
h2 ~ h1, | |
h3 ~ h1, | |
h4 ~ h1, | |
h5 ~ h1, | |
h6 ~ h1, | |
h3 ~ h2, | |
h4 ~ h2, |
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
// min() / max() | |
.element{ | |
// old | |
width: 50vw; | |
max-width: 500px; | |
// new | |
width: min(50vw, 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
/* | |
@source | |
https://drafts.csswg.org/mediaqueries-5/#mf-user-preferences | |
https://css-tricks.com/weekly-platform-news-reduced-motion-cors-whitehouse-gov-popups-and-100vw/ | |
*/ | |
/* contrast */ | |
@media (prefers-contrast: no-preference|less|more) { | |
/* … */ | |
} |
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
// choose a color | |
$icon-color: #F84830; | |
// functions to urlencode the svg string | |
@function str-replace($string, $search, $replace: '') { | |
$index: str-index($string, $search); | |
@if $index { | |
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); | |
} | |
@return $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
/** | |
* Returns the base path of the environment | |
* | |
* @type {Function} | |
* @return {String} | |
*/ | |
var path = require('path'); | |
module.exports = function (context) { | |
return path.dirname(path.relative(context.data.file.history.toString(), context.data.file.base.toString())) + '/'; |
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
{% header "Content-Type: application/rss+xml" %} | |
{% if not craft.app.config.general.membersOnly %} | |
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:atom="http://www.w3.org/2005/Atom" | |
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" | |
xmlns:slash="http://purl.org/rss/1.0/modules/slash/" |