This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SENTINEL = -Infinity; | |
function groupEvents(events) { | |
if (!Array.isArray(events) || events.length === 0) { | |
return []; | |
} | |
events = events.slice(); | |
events.sort((a, b) => a.start - b.start); | |
let group, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HAS_NATIVE_CE = window.customElements != null; | |
const HTMLElement = HAS_NATIVE_CE ? window.HTMLElement : class{ constructor(self) { return self; } }; | |
export class CustomElement extends HTMLElement { | |
constructor(inst) { | |
this.__instance = super(inst); | |
return this.__instance; | |
} | |
get props() { | |
return Object.assign({}, this.__props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input | |
function NumberPad({ onPadPressed } = props) { | |
let keys = [0, 1, 2, 3, 4, 5, 6, 7, 8]; | |
return keys.map(digit => <button key={digit} onClick={(event) => { onPadPressed({ digit: digit }); }}>{key}</button>); | |
} | |
function Calculator({ result, set} = props) { | |
return <div style={{ backgroundColor: 'gray' }}> | |
<input type="text" readOnly="true" value={result} /> | |
<NumberPad onPadPressed={(event) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_queue = []; | |
_isRunning = false; | |
async _runLoop(task) { | |
let job, queue = this._queue; | |
if (this._isRunning) { | |
// Preempt the current tasks | |
while (job = queue[0]) { | |
queue.shift(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.fit { | |
position: absolute; | |
top: 0px; | |
left: 0px; | |
bottom: 0px; | |
right: 0px; | |
width: 100%; | |
height: 100%; | |
object-fit: cover; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! function(t, i) { | |
"object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : t.Layout = i() | |
}(this, function() { | |
"use strict"; | |
function t(t) { | |
return new Promise(function(i, n) { | |
function s(h, o) { | |
try { | |
var r = t[o ? "throw" : "next"](h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template tag="video-playback-control"> | |
<style> | |
:host { | |
display: block; | |
} | |
#playButton::slotted { | |
color: red; | |
} | |
</style> | |
<slot id="playButton" name="play-button"></slot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var libPromise = new Promise(function(resolve) { | |
window.Lib = window.Lib || []; | |
window.Lib.push(resolve); | |
}); | |
libPromise.then(function(lib) { | |
// ... | |
}); | |
libPromise.then(function(lib) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Polymer.Debouncer = function Debouncer() { | |
this._scheduler = Polymer.Async.microTask; | |
this._timer = null; | |
this._wait = 0; | |
this.flush = this.flush.bind(this); | |
}; | |
Polymer.Utils.mixin(Polymer.Debouncer.prototype, { | |
after: function(scheduler, wait) { | |
this._scheduler = asyncModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dom-module id="x-list"> | |
<template> | |
<iron-list item-height="_getItemHeight"></iron-list> | |
</template> | |
<script> | |
Polymer({ | |
is: 'x-list', | |
_getItemHeight: function(node) { | |
if (node.hasTimeGap) { | |
return 116; |