Skip to content

Instantly share code, notes, and snippets.

@vsambor
vsambor / JavaScriptGetNestedValues.js
Last active June 4, 2019 08:38
A JavaScript function which assures that a value of a child chain property is returned without runtime errors.
const obj = {
c: {
a: 2,
b: {
c: [1, 2, 3, {a: 15, b: 10}, 15]
},
c: undefined,
d: null
},
d: ''
@vsambor
vsambor / .sass
Created December 25, 2017 12:12
SASS Margin and Padding Helper Generator
# Margin and Padding Helper Generator
$space: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 75, 100);
$pos: (top, bottom, left, right);
@each $s in $space {
.m#{$s} { margin: #{$s}px; }
.p#{$s} { margin: #{$s}px; }
@each $p in $pos {
.m#{str-slice($p, 0, 1)}-#{$s} { margin-#{$p}: #{$s}px; }