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'; | |
import { useHistory as originalUseHistory } from 'react-router-dom'; | |
import { parse, stringify } from 'lib/normalizingQs'; | |
export function useHistory({ keepQuery } = {} ) { | |
const history = originalUseHistory(); | |
if(!keepQuery) { | |
return history; | |
} | |
const cachedHistory = React.useMemo( () => { |
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, { useRef, useState, useEffect } from 'react'; | |
import styled, {css} from 'styled-components'; | |
const Landing = () => ( | |
<div> | |
<Uploader width={640} height={480} /> | |
</div> | |
); | |
const Form = styled.form` |
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 error = require('debug')('server:error'); | |
const store = require('./data'); | |
const Koa = require('koa'); | |
const Router = require('koa-router'); | |
const omit = require('./utils/omit'); | |
const app = new Koa(); | |
const api = new Router(); | |
const cors = require('./middleware/cors'); | |
const mount = require('koa-mount') | |
const bodyParser = require('koa-bodyparser')(); |
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 React = require('react'); | |
module.exports = function List({ children, ...other }) { | |
return ( | |
<ul {...other}> | |
{ React.Children.toArray(children).map((child) => <li key={child.key}>{child}</li> ) }; | |
</ul> | |
); | |
} |
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
module.exports = (target, path, defaultValue) => path.reduce( | |
(obj, key) => obj && obj.hasOwnProperty(key) ? obj[key] : null | |
, target | |
) || defaultValue; |
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
module.exports = (obj, ...keys ) => keys.reduce((result, key) => Object.assign(result, { [key]: obj[key] }), {}); |
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 maxfps = 60/1000; | |
const tween = TweenComponent => { | |
return class Tween extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
request: 0, | |
duration: Math.floor(5000 * maxfps), | |
start: 0, | |
from: props.from || 0, |
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 default function composeReducers(...reducers) { | |
return (state, action) => reducers.reduce((result, fn)=>fn(result, action), state); | |
} |
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
var canvas = document.getElementById('canvas1'); | |
var img = new Image; | |
var mst = new Image; | |
var mstSrc = "http://i.ytimg.com/vi/zNeaXKF0Eik/maxresdefault.jpg"; | |
var imgSrc = "http://www.goodwp.com/images/201303/goodwp.com_27776.jpg"; | |
const drawBackground = (canvas) => { | |
const ctx = canvas.getContext('2d'); | |
ctx.globalCompositeOperation = "source-over"; | |
ctx.globalAlpha = 1; |
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 strict'; | |
var React = require('react'); | |
var util = { | |
// findPos() by quirksmode.org | |
// Finds the absolute position of an element on a page | |
findPos: function (obj) { | |
/*jshint -W084 */ | |
var curleft = 0, |