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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
import { h, Component } from 'preact'; | |
import { Router } from 'preact-router'; | |
import Header from './header'; | |
import Home from '../routes/home'; | |
import Profile from '../routes/profile'; | |
import NotifyChange from "./NotifyChange/index"; | |
// import Home from 'async!../routes/home'; | |
// import Profile from 'async!../routes/profile'; |
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 isMobileDevice() { | |
return window.matchMedia('(hover: none) and (pointer: coarse)'); | |
} |
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
export function observe(key, callback, opts) { | |
const single = !Array.isArray(key); | |
const keypaths = single ? [ key ] : key; | |
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
const keys = parts.map(parts => parts[0]); | |
const fn = callback.bind(this); | |
let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
if (!opts || opts.init !== false) { |
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
export function observe(key, callback, opts) { | |
const single = !Array.isArray(key); | |
const keypaths = single ? [ key ] : key; | |
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
const keys = parts.map(parts => parts[0]); | |
const fn = callback.bind(this); | |
let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
if (!opts || opts.init !== false) { |
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
export function observe(key, callback, opts) { | |
const single = !Array.isArray(key); | |
const keypaths = single ? [ key ] : key; | |
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
const keys = parts.map(parts => parts[0]); | |
const fn = callback.bind(this); | |
let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
if (!opts || opts.init !== false) { |
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
/*! | |
* Copyright 2015 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
navigator.serviceWorker.getRegistrations().then(function (registrations) { | |
if (!registrations.length) { | |
console.log('No serviceWorker registrations found.') | |
return | |
} | |
for(let registration of registrations) { | |
registration.unregister().then(function (boolean) { | |
console.log( | |
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' + | |
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') + |
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 _ = require('lodash'); | |
module.exports = ({e, addUtilities, config}) => { | |
const gradients = config('gradients', []) | |
const variants = config('modules.gradients') | |
const gradientUtilities = _.map(gradients, (colors, name) => { | |
if (!_.isArray(colors)) { | |
colors = ['transparent', colors]; | |
} |
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
*, *:before, *:after { | |
-moz-box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
body { | |
font-family: 'Lato', sans-serif; | |
color: #333; | |
font-weight: 400; |
OlderNewer