You may need to configure a proxy server if you're having trouble cloning
or fetching from a remote repository or getting an error
like unable to access '...' Couldn't resolve host '...'.
Consider something like:
| // Get all users | |
| var url = "http://localhost:8080/api/v1/users"; | |
| var xhr = new XMLHttpRequest() | |
| xhr.open('GET', url, true) | |
| xhr.onload = function () { | |
| var users = JSON.parse(xhr.responseText); | |
| if (xhr.readyState == 4 && xhr.status == "200") { | |
| console.table(users); | |
| } else { | |
| console.error(users); |
| /* | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2016 Esa-Matti Suuronen <esa-matti@suuronen.org> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. |
| { | |
| "presets": ["es2015"], | |
| "plugins": ["transform-runtime"] | |
| } |
| 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 |
| pm2 start app.js --interpreter ./node_modules/.bin/babel-node |
| // quick snippet to check the connection in your RN app | |
| // dispatches an `setIsConnected` action every time the NetInfo changes (on/off network) | |
| componentDidMount() { | |
| const dispatchConnected = isConnected => this.props.dispatch(setIsConnected(isConnected)); | |
| NetInfo.isConnected.fetch().then().done(() => { | |
| NetInfo.isConnected.addEventListener('change', dispatchConnected); | |
| }); | |
| } |
| { | |
| "apps": [{ | |
| "name": "Application", | |
| "exec_interpreter": "./node_modules/babel-cli/bin/babel-node.js", | |
| "script": "./bin/www", | |
| "args": [], | |
| "watch": ["public", "package.json", "pm2.development.json"], | |
| "ignore_watch": ["public"], | |
| "watch_options": { | |
| "persistent": true, |
Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.