Skip to content

Instantly share code, notes, and snippets.

View AlexFrazer's full-sized avatar
🦊
🦊🦊🦊

Frazer AlexFrazer

🦊
🦊🦊🦊
View GitHub Profile
import React from 'react';
import { Link } from 'react-router';
type Props = {};
export default function Facet({
property,
value,
label,
...props,
import React, { Component } from 'react';
import styles from './feed.scss';
type Props = {
data: Array<{ id: string }>,
threshold: number,
children: (item: { id: string }, index: number) => React.Element<any>,
};
export default class Feed extends Component {
import React, { Component } from 'react';
type Props = {
value: ?string,
onChange: ?() => {},
onStopTyping: ?() => void,
onStartTyping: ?() => void,
};
type State = {
export function toggleFullscreen(element: HTMLElement = document) {
const isFullscreen = [
document.fullscreenElement,
document.webkitFullscreenElement,
document.mozFullScreenElement,
document.msFullscreenElement,
].some(Boolean);
if (!isFullscreen) {
if (element.requestFullscreen) {
function generatePosters(files: [File]) {
return async dispatch => {
for (const { data, id } of files) {
const poster = await generatePoster(data);
dispatch({
type: GENERATE_POSTER,
payload: { id, poster },
});
}
}
Promise.all([
import("react"),
import("react-dom"),
import("react-router"),
import("react-router-redux"),
import("source/store"),
import("containers/Root"),
import("source/index.css"),
import("whatwg-fetch"),
import("babel-polyfill"),
import React, { Component, PropTypes } from 'react';
export default class LazilyLoad extends Component {
static propTypes = {
modules: PropTypes.object,
children: PropTypes.func.isRequired,
};
static defaultProps = { modules: {} };
async function request(...args) {
try {
await makeRequest(...args);
} catch (e) {
await getRefreshToken();
// try to re-request the previous asset
}
}
async function getRefreshToken() {
async function getX() {
let users = [];
try {
x = await getUsers();
} catch (e) { }
return x;
}
// vs
const path = require('path');
const webpack = require('webpack');
const HTMLPlugin = require('webpack-html-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const basePath = path.resolve(__dirname, './app/');
const outPath = path.resolve(__dirname, './dist');
module.exports = {