Skip to content

Instantly share code, notes, and snippets.

Reading your blog posts

Šime Vidas simevidas

Reading your blog posts
View GitHub Profile
simevidas / finished-polyfill.js
Last active May 17, 2020 — forked from AdaRoseCannon/Finished polyfill.js
Animation.prototype.finished polyfill
View finished-polyfill.js
// only polyfill .finished in browsers that already support animate()
if (document.body.animate) {
// Chrome does not seem to expose the Animation constructor globally
if (typeof Animation === 'undefined') {
window.Animation = document.body.animate({}).constructor;
if (Animation.prototype.finished === undefined) {
Object.defineProperty(Animation.prototype, 'finished', {
View applyTemplate.js
const applyTemplate = (templateElement, data) => {
const element = templateElement.content.cloneNode(true);
const treeWalker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, () => NodeFilter.FILTER_ACCEPT);
while (treeWalker.nextNode()) {
const node = treeWalker.currentNode;
for (let bindAttr in node.dataset) {
if (bindAttr.startsWith('bind_')) {
let dataKey = node.dataset[bindAttr];
let bindKey = bindAttr.substr(5);
View perfect-plugin.html
<!doctype html>
<title>Tabs Demo!</title>
<link href="//" rel="stylesheet">
<style type="text/css">
.container {
margin-top: 20px;
View gist:6708899
if (screen.width <= 640) document.write('<meta name="viewport" content="width=device-width, initial-scale=1">');
View encoding.html
<script>document.write('<meta charset="utf-8">')</script>
document.body.innerHTML += "✓";
You can’t perform that action at this time.