const pApply = (fn, ...cache) => (...args) => {
const all = cache.concat(args);
return all.length >= fn.length ? fn(...all) : pApply(fn, ...all);
};
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'; | |
const visible = isVisible => Component => { | |
class VisibleComponent extends React.Component { | |
componentDidMount() { | |
this.unsubscribe = this.context.store.subscribe(this.handleChange.bind(this)); | |
} | |
componentWillUnmount() { | |
this.unsubscribe(); |
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 axios from 'axios' | |
let mockingEnabled = false | |
const mocks = {} | |
export function addMock(url, data) { | |
mocks[url] = data | |
} |
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
code --install-extension akamud.vscode-caniuse && \ | |
code --install-extension andys8.jest-snippets && \ | |
code --install-extension auiworks.amvim && \ | |
code --install-extension bibhasdn.unique-lines && \ | |
code --install-extension christian-kohler.npm-intellisense && \ | |
code --install-extension cssho.vscode-svgviewer && \ | |
code --install-extension dbaeumer.vscode-eslint && \ | |
code --install-extension dzannotti.vscode-babel-coloring && \ | |
code --install-extension eamodio.gitlens && \ | |
code --install-extension eg2.tslint && \ |
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://github.com/alfonsomunozpomer/react-fetch-mock | |
import React from 'react' | |
import fetchMock from 'fetch-mock' | |
import Enzyme from 'enzyme' | |
import {shallow, mount, render} from 'enzyme' | |
import Adapter from 'enzyme-adapter-react-16' | |
Enzyme.configure({ adapter: new Adapter() }) |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Exercise: | |
// | |
// Make `withMouse` a "higher-order component" that sends the mouse position | |
// to the component as props. | |
// | |
// Hint: use `event.clientX` and `event.clientY` | |
// | |
// Got extra time? | |
// |
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
# What the fuck just happened to this file? | |
git reflog -p --since=yesterday -- $file | |
# I forgot my branch name. What am I working on? | |
git for-each-ref --sort=-committerdate refs/heads --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)'|column -ts'|' |
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 Input from './input'; | |
import Label from './label'; | |
import FormGroup from './form-group'; | |
export default function Field ({children, name, inline, ...props}) { | |
return ( | |
<FormGroup inline={ inline }> | |
<Label inline={ inline } htmlFor={ name }>{ label }</Label> | |
<Input inline={ inline } { ...props } id={ name }> | |
{ children } |
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 Loader from '../components/loader'; | |
export default function fetchData(url, options) { | |
return (Component) => class fetchComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
finished = false; | |
data = null; |
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
git rebase --interactive HEAD~2 | |
# we are going to squash c into b | |
pick b76d157 b | |
pick a931ac7 c | |
# squash c into b | |
pick b76d157 b | |
s a931ac7 c |
NewerOlder