Skip to content

Instantly share code, notes, and snippets.

View daKmoR's full-sized avatar
❤️
Web Components & open-wc

Thomas Allmer daKmoR

❤️
Web Components & open-wc
View GitHub Profile
@daKmoR
daKmoR / Markdium-JavaScript.js
Created February 18, 2020 12:24
Markdium-What is a Mixin?
// defining the Mixin
export const LoggingMixin = superclass =>
class LoggingMixin extends superclass {
// logging logic
};
class Page {}
// applying a Mixin
class PageRed extends LoggingMixin(Page) {}
class PageGreen extends LoggingMixin(Page) {}
@daKmoR
daKmoR / index.stories.js
Created December 11, 2019 19:55
Storybook - source code order how?
import { html } from '../../index.js';
import '../demo-wc-card.js';
export default {
title: 'Demo Card|Component Story Format',
component: 'demo-wc-card',
};
export const heading = () =>
@daKmoR
daKmoR / CLA.md
Created December 17, 2018 12:51
CLA for MIT license

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the MIT license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the MIT license; or

@daKmoR
daKmoR / index.js
Last active March 21, 2019 22:31 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
const util = require('util');
const exec = util.promisify(require('child_process').exec);
async function systemVersionInfos() {
const { stdout: nodeVersion } = await exec('node --version');
console.log('$ node --version');
console.log(nodeVersion);
@daKmoR
daKmoR / asdf
Created October 7, 2018 12:50
asdf
test
@daKmoR
daKmoR / container-masonry.html
Created April 21, 2017 13:10
masonry custom element
<link rel="import" href="../../../Polymer/Polymer/DomModules/BaseElement.html">
<link rel="import" href="../../../Polymer/Polymer/DomModules/ResponsiveBehavior.html">
<link rel="import" href="MasonryImport.html">
<style>
.container-masonry-animate-move-up {
transform: translateY(200px);
opacity: 0;
animation: containerMasonryMoveToOrigin 0.65s ease forwards;
}
@daKmoR
daKmoR / BaseElement.html
Created March 15, 2017 14:05
IE Edge will ignore inline style variables in webcomponents
<!--
IE Edge will ignore inline style variables in webcomponents
e.g. style="--my-color: #ccc" will not overwrite any default value for --my-color.
for an example open this in IE Edge
http://plnkr.co/edit/cSIs0ODeyUsaXiemxhyP?p=preview
If you extend an element from this element instead e.g.
class ImageBlock extends BaseElement {
}
inline style variables be properly set even in IE Edge.
@daKmoR
daKmoR / BaseElement.html
Created March 15, 2017 14:02
IE Edge will ignore inline style set variables e.g. style="--my-color: #ccc" will not overwrite any default value for my-color.
<link rel="import" href="../../../../bower_components/polymer/polymer.html">
<script>
class BaseElement extends Polymer.Element {
vhToPx(vh) {
if (vh.indexOf('vh') > 0) {
return document.documentElement.clientHeight * (parseInt(vh)/100) + '';
}
@daKmoR
daKmoR / BaseElement.html
Created March 15, 2017 14:02
IE Edge will ignore inline style set variables e.g. style="--my-color: #ccc" will not overwrite any default value for my-color.
<link rel="import" href="../../../../bower_components/polymer/polymer.html">
<script>
class BaseElement extends Polymer.Element {
vhToPx(vh) {
if (vh.indexOf('vh') > 0) {
return document.documentElement.clientHeight * (parseInt(vh)/100) + '';
}
@daKmoR
daKmoR / webcomponents-lite.min.js
Created January 5, 2017 20:48
v1 webcomponents-lite.min.js
!function(){window.WebComponents=window.WebComponents||{flags:{}};var a="webcomponents-lite.js",b=document.querySelector('script[src*="'+a+'"]'),c={};if(!c.noOpts){if(location.search.slice(1).split("&").forEach(function(a){var d,b=a.split("=");b[0]&&(d=b[0].match(/wc-(.+)/))&&(c[d[1]]=b[1]||!0)}),b)for(var e,d=0;e=b.attributes[d];d++)"src"!==e.name&&(c[e.name]=e.value||!0);if(c.log&&c.log.split){var f=c.log.split(",");c.log={},f.forEach(function(a){c.log[a]=!0})}else c.log={}}c.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=c.register),WebComponents.flags=c}(),function(a){"use strict";function f(a){return void 0!==d[a]}function g(){o.call(this),this._isInvalid=!0}function h(a){return""==a&&g.call(this),a.toLowerCase()}function i(a){var b=a.charCodeAt(0);return b>32&&b<127&&[34,35,60,62,63,96].indexOf(b)==-1?a:encodeURIComponent(a)}function j(a){var b=a.charCodeAt(0);return b>32&&b<127&&[34,35,60,62,96].indexOf(b)==-1?a:encodeURIComponent(a)}function n(a