Skip to content

Instantly share code, notes, and snippets.

View zastrow's full-sized avatar
🦄
Making the Web a magical place

Philip Zastrow zastrow

🦄
Making the Web a magical place
View GitHub Profile
@zastrow
zastrow / input.scss
Created April 3, 2023 15:27
Generated by SassMeister.com.
@use "sass:map";
$sizes: (
'regular': 1rem,
'small': 0.875rem,
'large': 2rem
);
@function size($size) {
@return map.get($sizes, $size);
@zastrow
zastrow / input.scss
Created April 3, 2023 14:31
Generated by SassMeister.com.
$bp-sm: 36rem;
.my-class {
color: red;
font-size: 1.25rem;
font-family: sans-serif;
@media (min-width: $bp-sm) {
font-size: 2rem;
}
@zastrow
zastrow / input.scss
Created March 4, 2022 14:25
Generated by SassMeister.com.
//Breakpoints
$bp-sm: 30rem;
$bp-md: 50rem;
$bp-lg: 60rem;
$bp-xl: 80rem;
$grid-breakpoints: (
sm: $bp-sm,
md: $bp-md,
lg: $bp-lg,
// This function pairs with the `motion` mixin
// to convert a `true` or `false` value to the
// appropriate media query value for reduce motion.
@function motion($value) {
@if $value {
@return 'no-preference';
}
@else {
@return 'reduce';
}
// Simplified version of color schemes. Options are `light` or `dark`
@mixin color-mode($value: light) {
@media (prefers-color-scheme: $value) {
@content;
}
}
@zastrow
zastrow / input.scss
Created February 2, 2021 15:29
Generated by SassMeister.com.
$media-queries: (
sm: 40rem,
lg: 80rem
);
@mixin loop-states {
&,
&\:hover:hover,
&\:active:active,
&\:focus:focus {
@zastrow
zastrow / input.scss
Created January 14, 2021 17:45
Generated by SassMeister.com.
$font-stack: sytem-ui, sans-serif;
@function font($override:null) {
@if $override {
@return $font-stack !important;
}
@else {
@return $font-stack;
}
}
@zastrow
zastrow / input.scss
Created January 14, 2021 17:42
Generated by SassMeister.com.
$font-stack: sytem-ui, sans-serif;
@mixin font($override:null) {
font-family: $font-stack $override;
}
.my-class {
@include font;
}
@zastrow
zastrow / ie11.js
Created December 1, 2020 14:42
Check if this is IE11
const checkIE = () => {
const isIE = /* @cc_on!@ */false || !!document.documentMode;
if (isIE) {
const html = document.getElementsByTagName('html')[0];
html.className += ' ie11';
}
};
checkIE();
@zastrow
zastrow / svg.scss
Last active March 4, 2022 12:58
In-CSS SVG
// Helper function to replace characters in a string
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@return if($index, str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace), $string);
}
// SVG URL fixer Icons by Taylor Hunt
// http://codepen.io/tigt/post/optimizing-svgs-in-data-uris
// Function to create an optimized svg url
@function svg($svg) {