Skip to content

Instantly share code, notes, and snippets.

View barbagrigia's full-sized avatar

Vlad Trukhin barbagrigia

View GitHub Profile
@barbagrigia
barbagrigia / index.js
Created February 12, 2018 18:21 — forked from ivosh/index.js
evolving-react-patterns-async-await
componentDidMount() {
this.setState({ content: this.props.loading() })
try {
const res = await fetch(this.props.url);
this.setState({ content: this.props.done(res.json()) });
} catch (err) {
this.setState({ content: this.props.error() });
}
}
@barbagrigia
barbagrigia / FlowTutorial.js
Created October 17, 2017 05:14 — forked from busypeoples/FlowTutorial.js
Flow Fundamentals For JavaScript Developers
// @flow
// Flow Fundamentals For JavaScript Developers
/*
Tutorial for JavaScript Developers wanting to get started with FlowType.
Thorough walkthrough of all the basic features.
We will go through the basic features to gain a better understanding of the fundamentals.
You can uncomment the features one by one and work through this tutorial.
@barbagrigia
barbagrigia / FlowReactTutorial.js
Created October 17, 2017 05:14 — forked from busypeoples/FlowReactTutorial.js
Flow Fundamentals For ReactJS Developers
// @flow
// Flow Fundamentals For ReactJS Developers
/*
Tutorial for ReactJS Developers wanting to get started with FlowType.
We will go through the basic Flow features to gain a better understanding of how to use FlowType with React.
You can uncomment the features one by one and work through this tutorial.
If you want to learn the very FlowType basics, refer to "Flow Fundamentals for JavaScript Developers" (https://gist.github.com/busypeoples/61e83a1becc9ee9d498e0db324fc641b) first.
@barbagrigia
barbagrigia / IntroductionToFlow.md
Created October 17, 2017 05:13 — forked from busypeoples/IntroductionToFlow.md
Introduction To Flow

Introduction To Flow

Intended for developers interested in getting started with Flow. At the end of this introduction, you should have a solid understanding of Flow and how to apply it when building an application.

Covers all the basics needed to get started with Flow.

Covers all the basic needed to get started with Flow and ReactJS.

@barbagrigia
barbagrigia / action-creators.js
Created October 7, 2017 16:41 — forked from anonymous/action-creators.js
create tagged union from return types of action-creators
// @flow
// Helper to extract inferred return type of a function
type _ExtractReturn<B, F: (...args: any[]) => B> = B;
type ExtractReturn<F> = _ExtractReturn<*, F>;
// Use constants as normal
const AGE = 'AGE';
const NAME = 'NAME';
// only need to provide types for arguments in action-creators
@barbagrigia
barbagrigia / findStringInFile.sh
Created September 21, 2017 23:42 — forked from kevin-smets/findStringInFile.sh
Find text in files and show file name + line number
find . -type f -name "*.scss" -exec bash -c 'grep -rin calc ${0};' {} \;
#!/bin/bash
for f in *.sass; do sass-convert $f ${f%sass}scss ; done
rm *.scss
@barbagrigia
barbagrigia / gitSemVer.sh
Created September 21, 2017 23:42 — forked from kevin-smets/gitSemVer.sh
SemVer tagging
git tag -a v1.0.0 -m 'tagging v1.0.0'
git push --tags
@barbagrigia
barbagrigia / csslint.clean.json
Created September 21, 2017 23:41 — forked from kevin-smets/csslint.clean.json
CSS lint options for the modern browser(s)
{
"box-model" : true,
"display-property-grouping" : true,
"duplicate-properties" : true,
"empty-rules" : true,
"known-properties" : true,
"non-link-hover" : false,
"adjoining-classes" : false,
"box-sizing" : false,
"compatible-vendor-prefixes" : true,
@barbagrigia
barbagrigia / gitConvertSassToScss.sh
Created September 21, 2017 23:41 — forked from kevin-smets/gitConvertSassToScss.sh
Converts all sass files (recursively) to scss in a git repo (rename should get picked up so history is still tied to the converted file).
find . -type f -name "*.sass" -exec bash -c 'sass-convert ${0} -i --to scss; git mv ${0} ${0%.sass}.scss' {} \;