- Run
react-native init AwesomeProject
- Change in package.json:
"react-native": "0.38.0"
"react": "15.4.1"
- Delete
node_modules
folder - Run
npm install
_handlePanResponderMove(event: Object, gestureState: Object): void { | |
if (this._isSwipingExcessivelyRightFromClosedPosition(gestureState)) { | |
return; | |
} | |
this.props.onSwipeStart(); | |
if (this._isSwipingRightFromClosed(gestureState)) { | |
this._swipeSlowSpeed(gestureState); | |
} else { | |
this._swipeFullSpeed(gestureState); | |
} |
react-native init AwesomeProject
"react-native": "0.38.0"
"react": "15.4.1"
node_modules
foldernpm install
function pingServers(servers) { | |
let failedServers = {}; | |
for (const url of servers) { | |
let failures = 0; | |
for (let i = 0 ; i < 3 ; i++) { | |
const response = blockingHttpRequest(url); | |
if (!response.ok) failures++; | |
blockingSleep(10000); | |
} | |
if (failures > 0) failedServers[url] = failures; |
import _ from 'lodash'; | |
import fetch from 'node-fetch'; | |
import delay from 'delay'; | |
export async function pingServers(servers) { | |
let failedServers = {}; | |
for (const url of servers) { | |
let failures = 0; | |
for (const i of _.range(3)) { | |
const response = await fetch(url); |
import _ from 'lodash'; | |
import fetch from 'node-fetch'; | |
import delay from 'delay'; | |
export function pingServers(servers) { | |
return _.reduce(servers, (failedServersAccumulator, url) => { | |
return failedServersAccumulator.then((failedServers) => { | |
return pingOneServer(url).then((failures) => { | |
if (failures > 0) failedServers[url] = failures; | |
return failedServers; |
import _ from 'lodash'; | |
import fetch from 'node-fetch'; | |
import delay from 'delay'; | |
export function pingServers(servers) { | |
return _.reduce(servers, (failedServersAccumulator, url) => { | |
return failedServersAccumulator.then((failedServers) => { | |
return _.reduce(_.range(3), (failuresAccumulator) => { | |
return failuresAccumulator.then(delay(10000)).then((failures) => { | |
return fetch(url).then((response) => { |
const servers = [ | |
'http://www.sevengramscaffe.com', | |
'http://www.hernanparra.co', | |
'http://www.thetimeandyou.com', | |
'http://www.luchoycarmelo.com' | |
]; | |
pingServers(servers).then( function (failedServers) { | |
for (const url in failedServers) { | |
console.log(`${url} failed ${failedServers[url]} times`); | |
} |
import request from 'request'; | |
import asyncLib from 'async'; | |
export function pingServers(servers, onComplete) { | |
let failedServers = {}; | |
asyncLib.eachSeries(servers, (url, onNextUrl) => { | |
let failures = 0; | |
asyncLib.timesSeries(3, (n, onNextAttempt) => { | |
request(url, (error, response) => { | |
if (error || response.statusCode !== 200) failures++; |
import request from 'request'; | |
export function pingServers(servers, onComplete) { | |
let state = { | |
servers, | |
currentServer: 0, | |
currentPingNum: 0, | |
failedServers: {} | |
}; | |
handleState(state, onComplete); |
const servers = [ | |
'http://www.sevengramscaffe.com', | |
'http://www.hernanparra.co', | |
'http://www.thetimeandyou.com', | |
'http://www.luchoycarmelo.com' | |
]; | |
pingServers(servers, function (failedServers) { | |
for (const url in failedServers) { | |
console.log(`${url} failed ${failedServers[url]} times`); | |
} |