Skip to content

Instantly share code, notes, and snippets.

Avatar

Ferdi ferdiemmen

View GitHub Profile
@ferdiemmen
ferdiemmen / submodule-pull.sh
Created Jun 13, 2018 — forked from stephenparish/submodule-pull.sh
Update submodules in a git repository to the latest, but exclude one..
View submodule-pull.sh
git submodule foreach '[ "$path" == "submodule-to-exclude" ] || git pull origin master'
View gist:2adf128ce23252abfc25e958541ace9e
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
View gist:fe8ca10edcc73cd493bef5f558a9cfdf
let cookies = {};
document.cookie.split(' ').map(x => x.replace(/;$/g, '').split('=')).map(x => { cookies[x[0]] = x[1]; return x; });
View gist:7c52915195b54419fb8e690fed8fe554
npm version patch -m 'version(package): update to %s'
git push
@ferdiemmen
ferdiemmen / gist:bb61e424b5f78166d1a463f7b7c3683b
Created Dec 19, 2017
Regex which covers all possible e-mail addresses according to the RFC spec
View gist:bb61e424b5f78166d1a463f7b7c3683b
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-.]+$)"
View gist:4da598b46e2b934972b257cac39c5a13
## Deconstruction array items
const myArray = ['apple', 'nut', 'mies'];
const [apple] = myArray;
console.log(apple);
'apple'
@ferdiemmen
ferdiemmen / gist:54a12e92ac328d40ceee20e8067cab44
Created Dec 6, 2017
Json stringify ignores keys whose values are undefined
View gist:54a12e92ac328d40ceee20e8067cab44
var breakfast = {
"cereal" : "fruit loops",
"pastry" : undefined
};
console.log(breakfast);
// -> { cereal: 'fruit loops', pastry: undefined }
console.log(JSON.stringify(breakfast));
// -> {"cereal":"fruit loops"}
View gist:e51bef703f34bb92a8a2dd720b2a4b6c
// ================== 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) {
View gist:c7e5e023155801bd3eae736697d689bf
const id = 42;
const myArray = [
{
id: 1,
name: 'foobar',
},
{
id: 7,
name: 'lucky',
You can’t perform that action at this time.