Skip to content

Instantly share code, notes, and snippets.

@jakob-e
jakob-e / unitconversion.scss
Last active October 26, 2022 17:20
SCSS unit conversion functions
// ==========================================================
// Unit Conversion
// ==========================================================
//
// Functions:
// ----------------------------------------------------------
//
// NUMBER:
//
// isNaN($value) - returns true or false if type-of($value)==number
@jakob-e
jakob-e / input.scss
Created January 24, 2021 11:20
Generated by SassMeister.com.
// ----------------------------------------
// emulate include-context
// ----------------------------------------
$include-context-list: ();
@mixin include-context($name){
$include-context-list: append($include-context-list, $name, comma) !global;
@content;
$include-context-list: nth-remove($include-context-list, -1) !global;
}
@function include-context(){
@jakob-e
jakob-e / input.scss
Last active January 24, 2021 11:19
Generated by SassMeister.com.
// ----------------------------------------
// emulate mixin-context
// ----------------------------------------
$mixin-context-list: ();
@mixin mixin-context($name){
$mixin-context-list: append($mixin-context-list, $name, comma) !global;
@content;
$mixin-context-list: nth-remove($mixin-context-list, -1) !global;
}
@function mixin-context(){
@jakob-e
jakob-e / input.scss
Last active January 24, 2021 10:59
Generated by SassMeister.com.
// ----------------------------------------
$trace-list: ();
@mixin trace($name){
$trace-list: append($trace-list, $name, comma) !global;
@content;
$trace-list: nth-remove($trace-list, -1) !global;
}
@function nth-remove($list, $n){
$r: ();$n: if($n < 0, length($list) + $n + 1, $n); $b: is-bracketed($list); $s: list-separator($list);
@for $i from 1 through length($list){ @if $i != $n { $r: append($r, nth($list, $i)); }}
@jakob-e
jakob-e / input.scss
Created January 24, 2021 10:38
Generated by SassMeister.com.
// ----------------------------------------
$trace-list: ();
@mixin trace($name){
$trace-list: append($trace-list, $name, comma) !global;
@content;
$trace-list: nth-remove($trace-list, -1) !global;
}
@function nth-remove($list, $n){
$r: ();$n: if($n < 0, length($list) + $n + 1, $n); $b: is-bracketed($list); $s: list-separator($list);
@for $i from 1 through length($list){ @if $i != $n { $r: append($r, nth($list, $i)); }}
@jakob-e
jakob-e / input.scss
Created January 20, 2021 16:37
Generated by SassMeister.com.
$once: ();
@mixin once($key){
@if not index($once, $key){
$once: append($once, $key) !global;
@content;
}
}
@jakob-e
jakob-e / object-fit.js
Created November 4, 2018 23:39
object-fit for ie9+ (image only)
// is object fit supported
if (document.body.style.objectFit === undefined) {
// loop through all images
[].slice
.call(document.querySelectorAll('img'))
.map(img => {
// image has background-size cover or contain
// ––––––––––––––––––––––––––––––––––––––––––––––––––
// frankly
//
// font-smoothing
// font-size
//
// ––––––––––––––––––––––––––––––––––––––––––––––––––
@jakob-e
jakob-e / SassMeister-input.scss
Created August 31, 2014 09:27
Generated by SassMeister.com.
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
// ===============================================================================================
// Shorthands
// ===============================================================================================
// Absolute length
@function px($val) { @return convert-to-length($val, px); }
@jakob-e
jakob-e / SassMeister-input-HTML.html
Last active April 9, 2018 16:48
Generated by SassMeister.com.
===========================
str-replace
str-to-map
TODO - Add mqs to lists
===========================