Table of Contents generated with DocToc
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 { View, Text } from 'react-native' | |
import { css } from 'glamor-native' | |
export App = () => { | |
<View style={css({ color: 'red' })}> | |
<Text>Hello world!</Text> | |
</View> | |
} |
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
// Add a 401 response interceptor | |
window.axios.interceptors.response.use(function (response) { | |
return response; | |
}, function (error) { | |
if (401 === error.response.status) { | |
swal({ | |
title: "Session Expired", | |
text: "Your session has expired. Would you like to be redirected to the login page?", | |
type: "warning", | |
showCancelButton: true, |
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
// this is a generic runner for iterators | |
// for every yield, it checks to see if any time is remaining | |
// on the idle loop, and executes more work if so. | |
// else, it queues up for the next idle period | |
function go(it, callback){ | |
requestIdleCallback(deadline => { | |
let val = it.next() | |
while(!val.done){ | |
if(deadline.timeRemaining() <= 0){ |
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 weak | |
function now() { | |
return +new Date(); // timestamp in ms | |
} | |
// Count the number of events sent over the last period of time. | |
const count = { | |
minute: { | |
slot: 0, |
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 weak | |
import raven from 'raven-js'; | |
import config from 'config'; | |
const SENTRY_DSN = 'https://[email protected]/YYYY'; | |
function sendQueue() { | |
const sentryOffline = JSON.parse(window.localStorage.sentryOffline); |
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
/* intersperse: Return an array with the separator interspersed between | |
* each element of the input array. | |
* | |
* > _([1,2,3]).intersperse(0) | |
* [1,0,2,0,3] | |
*/ | |
function intersperse(arr, sep) { | |
if (arr.length === 0) { | |
return []; | |
} |
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
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache | |
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache | |
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache | |
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache |
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
//////////////////////////////////////////////////////////////////////// | |
// Intro | |
/////////////////////// | |
// Tools like Redux-saga, React-redux and Reselect can easily be used without Redux | |
// For Reselet there's nothing to do, it's just not coupled to Redux | |
// For the others, you just need to provide an adapter | |
// At Stample.co we use a legacy framework that is quite close to Redux but with a bad API | |
// We want to progressively migrate to Redux, so starting now to use Redux tools on new features will make our migration faster |
My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...
Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they