Skip to content

Instantly share code, notes, and snippets.

View MattMcAdams's full-sized avatar
🏠
Working from home

Matthew McAdams MattMcAdams

🏠
Working from home
View GitHub Profile
@MattMcAdams
MattMcAdams / tableQuestion.css
Last active October 18, 2018 19:32
Return item in a table based on two questions
body{
font-family: sans-serif;
}
#Q2{
display: none;
}
.answers div{
display: none;
}
.show{
@MattMcAdams
MattMcAdams / StickyFooter.css
Last active September 19, 2019 13:12
Sticky Footer with JavaScript
body {
--offset: 0px;
}
#wrapper {
min-height: 100vh;
min-height: calc(100vh - var(--offset));
}
/*
@MattMcAdams
MattMcAdams / IESpecific.css
Created May 21, 2019 17:41
IE 10 / 11 specific styles
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
}
@MattMcAdams
MattMcAdams / overlay.css
Last active September 19, 2019 12:54
Proof of concept Image overlay
/* Allow positioning of the overlay */
.overlay {
position: relative;
}
/* Create pseudo element to hold overlay effects */
.overlay::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
@MattMcAdams
MattMcAdams / anchor.html
Last active September 19, 2019 12:58
Style for hidden #link on each header so you can link to a section
<h2 id="my-section">
<a class="anchor" href="#my-section" aria-label="link to section"></a>
My Section
</h2>
<!-- OR -->
<section id="my-section">
<h2>
<a class="anchor" href="#my-section" aria-label="link to section"></a>
My Section
</h2>
@MattMcAdams
MattMcAdams / exponents.scss
Created September 24, 2019 20:59
utility function to calculate exponents
/// Power function
/// @group utility
/// @param {number} $base - number to be multiplied
/// @param {number (unitless)} $exponents - number of times it should be multiplied
/// @return `$base` to the power of `$exponents`
@function pow($base, $exponents) {
$raised: 1;
@for $i from 1 through $exponents {
$raised: $raised * $base;
}
@MattMcAdams
MattMcAdams / deepmap.scss
Created September 24, 2019 21:00
utility function to get value of a key in a deep map
/// Get value from a deep map
/// @group utility
/// @param {map} $map - source map to pull key from
/// @param {string...} $keys - key to extract value of
/// @return key value
@function map-deep-get($map, $keys...) {
@each $key in $keys {
$map: map-get($map, $key);
}
@return $map;
@MattMcAdams
MattMcAdams / color-functions.scss
Created September 24, 2019 21:02
Several functions and mixins to set and manipulate colors according to a scale
/// Tint color
/// @group utility
/// @param {color} $color - color to be tinted
/// @param {number(%)} $percentage - key to extract value of
/// @return `$color` mixed with white by `$percentage`
@function tint($color, $percentage) {
@return mix(white, $color, $percentage);
}
/// Shade color
@MattMcAdams
MattMcAdams / space-unit.scss
Last active September 24, 2019 21:03
custom measurement unit to help maintain relationships between elements
/// base unit of measurement for spacing
/// @type number
$space-unit: $line-height !default;
/// function to create a general unit of measurement for spacing
/// @requires $space-unit
/// @group spacing
/// @param {number} $value
/// @return number(rem) = `$space-unit` times `$value`
@function s($value) {
@MattMcAdams
MattMcAdams / functions.scss
Last active October 21, 2019 07:58
A group of functions to calculate font sizes and line heights based on a typographical scale
/// Power function
/// @group utility
/// @param {number} $base - number to be multiplied
/// @param {number (unitless)} $exponents - number of times it should be multiplied
/// @return `$base` to the power of `$exponents`
@function pow($base, $exponents) {
$raised: 1;
@for $i from 1 through $exponents {
$raised: $raised * $base;
}