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(Script) { | |
var _run = Script.prototype.run; | |
Script.prototype.run = function(ctx, domain, fn) { | |
if (typeof domain === 'object') { | |
domain.require = function(module) { | |
return require(module); | |
}; | |
domain.context = function() { // access Context via context() | |
return ctx; | |
}; |
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
// window.saveAs | |
// Shims the saveAs method, using saveBlob in IE10. | |
// And for when Chrome and FireFox get round to implementing saveAs we have their vendor prefixes ready. | |
// But otherwise this creates a object URL resource and opens it on an anchor tag which contains the "download" attribute (Chrome) | |
// ... or opens it in a new tab (FireFox) | |
// @author Andrew Dodson | |
// @copyright MIT, BSD. Free to clone, modify and distribute for commercial and personal use. | |
window.saveAs || ( window.saveAs = (window.navigator.msSaveBlob ? function(b,n){ return window.navigator.msSaveBlob(b,n); } : false) || window.webkitSaveAs || window.mozSaveAs || window.msSaveAs || (function(){ |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2015 Fedia <[email protected]> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
/** | |
* Batshit crazy DOM serializer in 140byt.es fashion (138) | |
* Ships with a predefined limit of 99 childNodes | |
* | |
*/ | |
function (a,b,c){for(b=Array(99),c=0;c<99;b[c]=c++);return JSON.stringify(a,['nodeName','nodeValue','attributes','childNodes'].concat(b))} |
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
/** | |
* Refactored | |
* http://stackoverflow.com/questions/17678843/cant-restore-selection-after-html-modify-even-if-its-the-same-html | |
*/ | |
function saveSelection(el) { | |
var win = el.ownerDocument.defaultView; | |
var range = win.getSelection().getRangeAt(0); | |
var prefixRange = range.cloneRange(); | |
prefixRange.selectNodeContents(el); |
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
/** | |
* Dynamic loading of external CSS and Javascript files. 287 bytes minified. Usage: | |
* load(['some.css', 'lib.js'], function() { console.log('loaded!') }); | |
*/ | |
var load = function (urls, done) { | |
var doc = document; | |
var cnt = urls.length; | |
var head = doc.getElementsByTagName('head')[0]; | |
var onload = function () { |
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
//- polyfills | |
'use strict'; | |
(function (p) { | |
if (!p.matches) p.matches = p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector; | |
})(Element.prototype); | |
if (typeof window.CustomEvent !== 'function') { | |
window.CustomEvent = function (name, p) { | |
p = p || {}; |
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
// Hacky Rollup plugin to remove source maps from Svelte components compiled for SSR | |
const killSSRmaps = { | |
renderChunk(code) { | |
return { | |
code: code.replace(/,[\s\n]*map:\s*(["'])\{.+?\}\1/g, ""), | |
}; | |
}, | |
}; |