Skip to content

Instantly share code, notes, and snippets.

@Duske
Duske / web-push-subscription-helpers.js
Created October 14, 2017 20:56
Helper functions to deal with web push encryption stuff
function generateKey(keyName, subscription) {
var rawKey;
rawKey = subscription.getKey ? subscription.getKey(keyName) : '';
return rawKey ?
btoa(String.fromCharCode.apply(null, new Uint8Array(rawKey))) :
'';
}
export function generatePublicKey(subscription) {
return Promise.resolve(generateKey('p256dh', subscription));
@Duske
Duske / styleConfig.js
Created October 12, 2017 08:48
zIndex Grouping
// Global CSS variables for Neos.Ui
const config = {
zIndex: {
// group by stacking context. All root properties of zIndex have "html" as parentStackingContext
secondaryToolbar: {
linkIconButtonFlyout: '1'
},
flashMessageContainer: {
context: '1'
},
@Duske
Duske / instructions.md
Created November 11, 2016 21:57
Ghost blog - Service worker starting

Please note that this is just my 2 cents to the service worker topic. It could be outdated, deprecated or overly complicated.

Files:

  • The actual service worker (serviceworker.js)
  • your existing JS on your page (e.g. main.js)

In main.js, the service worker gets installed like this:

const serviceWorkerUri = '/serviceworker-v1.9.js';