Skip to content

Instantly share code, notes, and snippets.

Hello
World
Test
const data = (html, width, height) =>
`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">` +
'<foreignObject width="100%" height="100%">' +
'<div xmlns="http://www.w3.org/1999/xhtml">' +
html +
'</div>' +
'</foreignObject>' +
'</svg>'
const htmlUrl = (element, width, height) => ({
@sanbornhilland
sanbornhilland / partiallyApply.js
Created September 9, 2017 15:01
ES6 Partial Application
function partiallyApply (...args) {
const func = args.shift()
return (...otherArgs) => func(...args, ...otherArgs)
}
/**
* Looks for any properties that exist on `mixin` but not on `receivingObject` and copies adds them to
* `receivingObject`
*
* @example
* var obj1 = {
* foo () {return 'foo from obj1'}
* }
*
* var obj2 = {
<!DOCTYPE html>
<html>
<head>
<script>
window.MediaSource = window.MediaSource || window.WebKitMediaSource;
function testTypes(types) {
for (var i = 0; i < types.length; ++i)
console.log("MediaSource.isTypeSupported(" + types[i] + ") : " + MediaSource.isTypeSupported(types[i]));
}
@sanbornhilland
sanbornhilland / EME Sniffer
Created January 14, 2015 19:02
Sniff browser for EME support.
// from http://www.jwplayer.com/html5/mediasource/
var haseme = document.getElementById('haseme');
window.MediaKeys = window.MediaKeys || window.MSMediaKeys || window.WebKitMediaKeys;
if (!!!window.MediaKeys) {
var html = 'Your browser does not support the Encrypted Media Extensions.';
} else {
var html = "The Encrypted Media Extensions are available for:<br />";
html += "- W3C Clear Key: "+ MediaKeys.isTypeSupported('org.w3.clearkey').toString() + "<br />";
html += "- Microsoft playReady: "+ MediaKeys.isTypeSupported('com.microsoft.playready').toString() + "<br />";