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
/* | |
Install from here: https://codepen.io/filipbech/full/RwarLVL | |
Before this becomes external, we should probably make the bookmarklet a loader and have the | |
source somewhere remote, so we can update it withot people having to re-install | |
*/ | |
(async () => { | |
const pageIdMetaTag = document.querySelector('meta[name=umb-page-id]'); |
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
self.addEventLister('fetch', event => { | |
if (event.request.url === 'app.js') { | |
event.respondWith(caches.match(new Request(event.request.url, { | |
mode: 'cors', | |
credentials: 'omit' | |
}) | |
} | |
}); |
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 moduleRequests = ['app.js', 'module1.js'] | |
.map(url => new Request(url, { | |
mode: 'cors', | |
credentials: 'omit' | |
})); | |
cache.addAll([ | |
'index.html', | |
...moduleRequests | |
]); |
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
<element-router> | |
<element-route path="/" element="home-page"></element-route> | |
<element-route path="/product/:uid" element="product-page"></element-route> | |
<element-route path="/lazy" import="lazy-element.js" element="lazy-element"></element-route> | |
<element-route path="/no-element"> | |
<template> | |
<style>h1 { color:red; }</style> | |
<h1>Yo this is an inline-template</h1> | |
</template> | |
</element-route> |
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
@Component({ ... }) | |
class ExampleComponent { | |
static name = 'Some arbitrary name'; | |
} | |
/*list of componentClasses that should be available this way*/ | |
const allComponents = [ ExampleComponent, /*more...*/ ]; | |
@Component({ | |
template:` |
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 serviceId = 0xffe5; | |
const characteristicId = 0xffe9; | |
const btn = document.getElementById('btn'); | |
const form = document.forms[0]; | |
let bulb; | |
document.getElementById('random').addEventListener('click',()=> { | |
setInterval(()=> { | |
bulb.writeValue(getColorValue(Math.ceil(Math.random()*255), Math.ceil(Math.random()*255), Math.ceil(Math.random()*255))); |
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
fetch('/endpoint', { | |
method: 'POST', | |
headers: new Headers({ | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}), | |
body: serialize({ | |
value: 1, | |
nested: { | |
value: '2' | |
} |
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
angular.module('$Ohttp',[]).factory('$Ohttp', function($http, $q) { | |
var $Ohttp = function(settings) { | |
var defer = $q.defer(); | |
return Rx.Observable.create(function(observer) { | |
$http(angular.extend(settings,{ | |
timeout:defer.promise | |
})).then(function(response) { | |
observer.next(response); | |
observer.complete(); | |
},function(err) { |
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
/* Define the animation with snap.svg*/ | |
var mySnapAni = myPath.animate({ | |
d:newDValue | |
},200); /* duration:200 doensn't matter since playback is via GSAP */ | |
/* Get the animation controller */ | |
var mySnapAniCtrl = mySnapAni[0].anims[Object.keys(mySnapAni[0].anims)[0]]; | |
/* Pause the animation right away*/ | |
mySnapAniCtrl.pause(); |
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
.htaccess | |
RewriteEngine on | |
RewriteRule ^umbraco/(.+?)$ umbraco.php?url=$1 [QSA,L] | |
## Nedenstående er til spa-ting | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d | |
RewriteRule ^ - [L] |
NewerOlder