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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
*/ | |
import React, { | |
AppRegistry, | |
Component, | |
StyleSheet, | |
Text, |
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 update(value) { | |
return (dispatch) => new Promise((resolve) => setImmediate( | |
() => { | |
dispatch({ type: 'UPDATE', value }); | |
resolve(); | |
} | |
)); | |
} |
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 urllib2 | |
import json | |
import time | |
def get(o, p, d=None): | |
keys = p.split('.') | |
rv = o | |
for key in keys: | |
if isinstance(rv, dict) and key in rv: | |
rv = rv[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
command -v prettier >/dev/null 2>&1 || { npm install -g prettier; } | |
usage() { | |
echo "usage: git-prettier.sh (format|validate) [<commit>]" | |
} | |
must_provide_commit_error () { | |
echo "Must provide a known revision to compare against" | |
usage | |
exit 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
import styled from 'styled-components/native'; | |
const getTitleFontSize = ({sizeClass}) => { | |
const sizes = { | |
small: 20, | |
large: 50, | |
}; | |
return sizes[sizeClass] || sizes['small']; | |
}; |
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
// @flow | |
import React, { PureComponent } from 'react'; | |
export default function createLazyComponent<A>( | |
getClass: () => Class<React.Component<void, A, void>> | |
) { | |
return class extends PureComponent { | |
componentWillMount() { | |
this.lazyComponentClass = getClass(); | |
} |
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
// @flow | |
export const Foo:'foo' = 'foo'; |