Skip to content

Instantly share code, notes, and snippets.

View rook2pawn's full-sized avatar
💭
Receiving the Love of God in Christ

david wee rook2pawn

💭
Receiving the Love of God in Christ
View GitHub Profile
@rook2pawn
rook2pawn / finished-polyfill.js
Created May 29, 2018 01:10 — forked from simevidas/finished-polyfill.js
Animation.prototype.finished polyfill
// 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', {
@rook2pawn
rook2pawn / String.prototype.template.js
Created January 6, 2016 10:15 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
// accepts optional transformer
// now transformers are compatible with ES6
String.prototype.template = function (fn, object) {'use strict';
// Andrea Giammarchi - WTFPL License
var
hasTransformer = typeof fn === 'function',
stringify = JSON.stringify,
re = /\$\{([\S\s]*?)\}/g,
strings = [],
values = hasTransformer ? [] : strings,