Skip to content

Instantly share code, notes, and snippets.

View joshuacerbito's full-sized avatar
🔥
🎸🎛🎛🎚🔊

Joshua Cerbito joshuacerbito

🔥
🎸🎛🎛🎚🔊
View GitHub Profile
@joshuacerbito
joshuacerbito / aspectRatio.js
Last active July 15, 2016 04:13
Get new width or height while preserving the aspect ratio
// Description: Get new width or height while preserving the aspect ratio
// TODO: Add AspectRatio related methods
var AspectRatio = {
getScaled: function ( currentW, currentH, newSize, property ) {
return ( property === 'width' )? ((currentH / currentW) * newSize) : (currentW / currentH) * newSize)
}
};
@joshuacerbito
joshuacerbito / sass_font-size_handling.scss
Created August 4, 2015 07:10
Handles font-size caculations
$base-font-size: 16px;
// Calculate rem value
@function calculateRem($size) {
$remSize: $size / $base-font-size;
@return $remSize * 1rem;
}
// Calculate Viewport-Width dependent value
@function calculateVW($size) {