- Install prettier
- Make a .prettierignore file, and add directories you'd like prettier to not format, for example:
**/node_modules
- Run
prettier --write "**/*.js"
*Don't forget the quotes. - Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
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
// TypeScript Fundamentals For JavaScript Developers | |
/* | |
Tutorial for JavaScript Developers wanting to get started with TypeScript. | |
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. | |
If you have any questions or feedback please connect via Twitter: | |
A. Sharif : https://twitter.com/sharifsbeat | |
*/ |
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
#!/bin/bash | |
echo "This script works with ONLY one Android device connected to system !!!" | |
echo "Killing adb" | |
adb kill-server | |
sleep 2 | |
PORT_NO=6969 | |
CONNETED_DEVICES=$(adb devices | wc -l) | |
if [ "$CONNETED_DEVICES" -le 2 ]; then | |
echo "NO Android device connected to your machine via USB." | |
else |
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 { Action, withStatechart } from 'react-automata' | |
const statechart = { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
FETCH: 'fetching', | |
}, |
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, { Component } from "react" | |
import { Machine } from "xstate" | |
import * as PropTypes from "prop-types" | |
class FiniteMachine extends Component { | |
machine = Machine(this.props.chart) | |
state = { | |
data: this.props.reducer(undefined, { type: "@init" }), | |
machineState: this.machine.getInitialState() |
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 ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children; | |
const Header = ({shouldLinkToHome}) => ( | |
<div> | |
<ConditionalWrap | |
condition={shouldLinkToHome} | |
wrap={children => <a href="/">{children}</a>} | |
> |
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
function getErroringPromise() { | |
console.log('getErroringPromise called'); | |
return Promise.reject(new Error('sad')); | |
} | |
Observable.defer(getErroringPromise) | |
.retry(3) | |
.subscribe(x => console.log); | |
// logs "getErroringPromise called" 4 times (once + 3 retries), then errors |
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 fs from 'fs'; | |
import path from 'path'; | |
import babel from 'rollup-plugin-babel'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
import nodeResolve from 'rollup-plugin-node-resolve'; | |
import typescript from 'rollup-plugin-typescript'; | |
import replace from 'rollup-plugin-replace'; | |
function findVersion(file, extensions) { | |
for (let e of extensions) { |
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 Modal from 'react-modal'; | |
import { addQuery, removeQuery } from './utils-router.js'; | |
const OPEN_MODAL_QUERY = 'openModal'; | |
function SomeComponent({ location }) { | |
return <div> | |
<button onClick={ () => addQuery({ OPEN_MODAL_QUERY : 1 })}>Open modal</button> | |
<Modal | |
isOpen={ location.query[OPEN_MODAL_QUERY] } |
NewerOlder