atom-text-editor {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
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 React from 'react'; | |
/** | |
* Server only Provider component that passes promises as context | |
*/ | |
export default class ServerFetchProvider extends React.Component { | |
static childContextTypes = { | |
serverFetchPromises: React.PropTypes.array | |
}; | |
static propTypes = { |
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.__testCleanup = () => { | |
const unregisterSW = () => { | |
return navigator.serviceWorker.getRegistrations() | |
.then((registrations) => { | |
const unregisterPromise = registrations.map((registration) => { | |
return registration.unregister(); | |
}); | |
return Promise.all(unregisterPromise); | |
}); | |
}; |
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
// https://medium.com/javascript-inside/safely-accessing-deeply-nested-values-in-javascript-99bf72a0855a | |
const idx = p => o => | |
p.reduce((xs, x) => | |
(xs && xs[x]) ? xs[x] : null, o) | |
const getUserComments = idx(['posts', 0, 'comments']) | |
const user = {} | |
console.log(getUserComments(user)) |
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 fs = require('fs'); | |
const path = require('path'); | |
const loadJsonFile = require('load-json-file'); | |
const dotNext = path.resolve(__dirname, '.next'); | |
const stats = loadJsonFile.sync(`${dotNext}/build-stats.json`); | |
const buildId = fs.readFileSync(`${dotNext}/BUILD_ID`, 'utf8'); |
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
class LazyImage extends PureComponent { | |
static defaultProps = { | |
engage: false, | |
}; | |
state = { | |
initialEngage: false, | |
}; | |
componentWillMount() { |
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
/** | |
`useChangeLog` - dev-mode helper hook to let you | |
know why a memoized component re-rendered! | |
Usage example: | |
const YourComponent = React.memo((props) => { | |
// Just drop this fella into your memo component's body. | |
useChangeLog(props); |
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 path = require('path') | |
const fs = require('fs') | |
class LoadablePlugin { | |
constructor({ filename = 'loadable-stats.json', writeToDisk = false } = {}) { | |
this.opts = { filename, writeToDisk } | |
} | |
gather = (hookCompiler, callback) => { | |
const stats = hookCompiler.getStats().toJson({ |
one line
(function () {
var cookies = document.cookie.split("; ");
for (var c = 0; c < cookies.length; c++) {
var d = window.location.hostname.split(".");
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
var p = location.pathname.split('/');
OlderNewer