Skip to content

Instantly share code, notes, and snippets.

@ferdiemmen
ferdiemmen / submodule-pull.sh
Created June 13, 2018 21:19 — forked from stephenparish/submodule-pull.sh
Update submodules in a git repository to the latest, but exclude one..
git submodule foreach '[ "$path" == "submodule-to-exclude" ] || git pull origin master'
i solved the same issue recently for this module and others like --> ngx translate and more...
solution (compile the js files into es2015):
npm i --save -dev babel-cli babel-preset-es2015
add this to the root project under the name .babelrc
{ "presets": ["es2015"] }
add a npm script in package.json in "scrtipsts" scope
let cookies = {};
document.cookie.split(' ').map(x => x.replace(/;$/g, '').split('=')).map(x => { cookies[x[0]] = x[1]; return x; });
@ferdiemmen
ferdiemmen / gist:7c52915195b54419fb8e690fed8fe554
Created January 19, 2018 09:02
Bump npm package version
npm version patch -m 'version(package): update to %s'
git push
@ferdiemmen
ferdiemmen / gist:bb61e424b5f78166d1a463f7b7c3683b
Created December 19, 2017 10:44
Regex which covers all possible e-mail addresses according to the RFC spec
Javascript:
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
Python:
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
@ferdiemmen
ferdiemmen / gist:4da598b46e2b934972b257cac39c5a13
Created December 13, 2017 08:52
Deconstruction array items
## Deconstruction array items
const myArray = ['apple', 'nut', 'mies'];
const [apple] = myArray;
console.log(apple);
'apple'
@ferdiemmen
ferdiemmen / gist:54a12e92ac328d40ceee20e8067cab44
Created December 6, 2017 07:44
Json stringify ignores keys whose values are undefined
var breakfast = {
"cereal" : "fruit loops",
"pastry" : undefined
};
console.log(breakfast);
// -> { cereal: 'fruit loops', pastry: undefined }
console.log(JSON.stringify(breakfast));
// -> {"cereal":"fruit loops"}
// ================== FIXED GRID OVERLAY ================== //
// Some calculated settings from the Foundation settings file
$base_image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8DgAwAEUgFNvg2eQgAAAABJRU5ErkJggg==');
$width: $global-width - rem-calc(map-get($grid-column-gutter, medium));
$offset: rem-calc(map-get($grid-column-gutter, medium));
$gutter: rem-calc(map-get($grid-column-gutter, medium));
$columns: $grid-column-count;
@mixin fixedGridOverlay($width, $columns, $gutter) {
const id = 42;
const myArray = [
{
id: 1,
name: 'foobar',
},
{
id: 7,
name: 'lucky',