Skip to content

Instantly share code, notes, and snippets.

@ankeetmaini
ankeetmaini / button.js
Created January 17, 2019 08:36 — forked from kentcdodds/button.js
how?
import 'pp-vx/dist/components/button/button.css'
import React from 'react'
import clsx from 'clsx'
const sizes: {[key: string]: string} = {
md: 'vx_btn--size_md',
sm: 'vx_btn--size_sm',
}
export type OneOrAnother<T1, T2> =
@ankeetmaini
ankeetmaini / ReducerComponent.js
Created September 7, 2017 06:28 — forked from jaredpalmer/ReducerComponent.js
React.ReducerComponent
import React from 'react';
class ReducerComponent extends React.Component {
constructor(props) {
super(props);
}
reducer = (state, action) => state;
dispatch = action => this.setState(state => this.reducer(state, action));
@ankeetmaini
ankeetmaini / Flow_Chapter_Two.md
Created August 31, 2017 16:41 — forked from busypeoples/Flow_Chapter_Two.md
Chapter 2: Using Flow

Back To The Basics

Chapter 2: Using Flow

Introduction

Why does it make sense to use FlowType or TypeScript when working with JavaScript? To give an appropriate answer, the best idea would be to build a small game or application to make the benefits clear.

@ankeetmaini
ankeetmaini / scratchpad.md
Created June 3, 2017 18:30 — forked from addyosmani/scratchpad.md
Webpack Performance Presets

"We need Webpack presets" and "Webpack and its plugins are too hard to configure correctly" have been the number one cause of developer pain shared with me from large sites adopting Progressive Web Apps and optimising their load performance.

If I was building a Webpack preset pack for performance, I might use the following:

  • Ensure you're using a production build of your framework: new webpack.DefinePlugin({ 'process.env': env })
  • Minify your JS: webpack.optimize.UglifyJsPlugin
  • Compress your resources (GZip): compression-webpack-plugin
  • Split your vendor chunks: CommonsChunkPlugin
@ankeetmaini
ankeetmaini / auto-deploy.md
Created March 15, 2017 03:40 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@ankeetmaini
ankeetmaini / AsyncComponent.jsx
Created January 26, 2017 18:29 — forked from lencioni/AsyncComponent.jsx
<AsyncComponent> at Airbnb used for Webpack code splitting
// Usage:
//
// function loader() {
// return new Promise((resolve) => {
// if (process.env.LAZY_LOAD) {
// require.ensure([], (require) => {
// resolve(require('./SomeComponent').default);
// });
// }
// });
@ankeetmaini
ankeetmaini / .eslintrc.js
Created December 16, 2016 15:09 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {