Skip to content

Instantly share code, notes, and snippets.

.scrolling-container {
// Firefox
scrollbar-width: none;
// IE 10+ / Edge Legacy
-ms-overflow-style: none;
// Chrome
&::-webkit-scrollbar {
display: none;
// Fixes collapsed right margin of last flex child.
// The overflow property applies only to content. It doesn't apply to padding or margins.
// Pseudo-elements on a flex container are rendered as flex items.
.flex-container:after {
content: '';
flex: 0 0 16px;
}
.flex-child {
// Using negative margins to allow a child container inside a parent container to display it's contents full width
.padded-parent-container {
padding: 0 25px;
}
.full-width-child {
margin: 0 -25px;
}
@alyssawilliams
alyssawilliams / unitless
Created September 28, 2019 16:57
Sass function that converts a pixel based line height into a unitless value
@function unitless($font-size, $line-height) {
@return $line-height / $font-size;
}
@alyssawilliams
alyssawilliams / rem
Created September 28, 2019 16:57
Sass function that converts pixels to rem
@function rem($pixels, $base: 16) {
@return #{$pixels/$base}rem;
}
@alyssawilliams
alyssawilliams / exclude-diff
Last active September 28, 2019 17:01
Runs a diff that excludes styles.css and it's sourcemap and opens the result in Sublime
git diff -- ':!dist/styles.css*' | subl
// Inserts a non breaking space character between the last two words in each text block, to prevent widows
$('.selector').each(function() {
var words = $(this).text().split(' ');
var replacement = words[words.length - 2] + '\xA0' + words[words.length - 1];
words.splice(words.length - 2, 1, replacement);
words.pop();
var updatedString = words.join(' ');
$(this).text(updatedString);
});