Skip to content

Instantly share code, notes, and snippets.

Ryan Goree RyanG26

View GitHub Profile
@RyanG26
RyanG26 / newAreaDimensions.js
Created Feb 4, 2019
Get new width and height based on desired area.
View newAreaDimensions.js
newAreaDimensions = (w, h, a) => {
const r = w/h;
return [
Math.sqrt(a*r),
Math.sqrt(a/r)
]
}
@RyanG26
RyanG26 / sass-cols.scss
Last active Aug 10, 2018
Sass Columns Mixin
View sass-cols.scss
@mixin cols($count, $gutter, $expand: false) {
display: flex;
flex-wrap: wrap;
margin-right: calc(-1 * #{$gutter} / 2);
margin-left: calc(-1 * #{$gutter} / 2);
.col {
flex: 1 1 calc((100% - #{$gutter} * #{$count}) / #{$count});
margin-right: calc(#{$gutter} / 2);
margin-left: calc(#{$gutter} / 2);
@RyanG26
RyanG26 / isEqual.js
Created May 25, 2018
Check if any 2 JavaScript Objects/Values are equal
View isEqual.js
const isEqual = (item1, item2) => {
// are they different types?
if (typeof item1 !== typeof item2) {
return false;
}
// if they aren't objects, are their values equal?
if (typeof item1 !== 'object') {
return item1 === item2;
View url-obj-polyfill.js
(function() {
if (typeof URL != 'function') {
rewriteURL();
} else if (!('searchParams' in new URL(window.location))) {
rewriteURL();
}
function rewriteURL() {
// Overwrite URL if no searchParams property exists.
You can’t perform that action at this time.