Promise.all waits till all the promises passed to it are resolved. Here is an example code snippet:
start 1 before wait 2 before wait 2 after wait 1 after wait end
Promise.all waits till all the promises passed to it are resolved. Here is an example code snippet:
start 1 before wait 2 before wait 2 after wait 1 after wait end
supervisor helps you automatically restart your process when something in your directory, or any type of files changes. This is particularly helped for developers making changes to their code base. They need not manually restart the server for each change. supervisor can take care of restarting.
To install supervisor globally, use:
# sudo npm install supervisor -g
When running a cordova server locally for testing, in order to use supervisor, use the following:
$ supervisor --ignore platforms -- /usr/local/bin/cordova run <platform>
For example:
$ supervisor --ignore platforms -- /usr/local/bin/cordova run browser
The --ignore platforms is required, else, during the build, the code gets changed in the platforms folder, and supervisor will unnecessarily restart the process.
Say you are building www.mycooldomain.com and want to test your changes locally, but using the www.mycooldomain.com domain itself in your browser.
Add an entry to your /etc/hosts file, like below:
127.0.0.1 www.mycooldomain.com
This option works as long as you do not want https to work. However, if you want https also to work, go for option 2.
Step 1: Install Charles Proxy, and add a setting under Tools -> Map Remote like the one below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | export class AppComponent implements OnInit { ngOnInit() { const gappClientId = "xxxxxx.apps.googleusercontent.com"; window.gapi_onload = function () { console.log("gapi onload called"); var auth2 = gapi.auth2.init({ client_id: gappClientId, scope: 'profile' }); }; var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/auth2.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); } } |
1 2 3 4 5 6 7 8 9 10 11 12 | function reverseString(str) { var temp; for (var i = 0; i<str.length/2; i++) { temp = str[i]; str[i] = str[str.length - i - 1]; str[str.length - i - 1] = temp; } } var a = new Buffer("how are you"); console.log(a.toString()); reverseString(a); |
1 2 | how are you uoy era woh |
npm config set registry http://registry.npmjs.org/
var packageJson, sys, exec, async, depJson, fs, deps; sys = require('sys'); exec = require('child_process').exec; async = require('async'); fs = require('fs'); packageJson = require(process.env.PWD + "/package.json"); deps = Object.keys(packageJson.dependencies); deps = deps.concat(Object.keys(packageJson.devDependencies)); async.each(deps, function (dep, cb) { console.log("Executing : npm ls --json " + dep); exec("npm ls --json " + dep, function (error, stdout) { var versionJson = JSON.parse(stdout); if (packageJson.dependencies[dep]) { packageJson.dependencies[dep] = "~" + versionJson.dependencies[dep].version; } if (packageJson.devDependencies[dep]) { packageJson.devDependencies[dep] = "~" + versionJson.dependencies[dep].version; } console.log(dep + ": " + versionJson.dependencies[dep].version); cb(); }); }, function (err) { if (err) { console.error("Following error occurred; not modifying package.json"); console.error(err); return; } fs.writeFile(process.env.PWD + "/package.json", JSON.stringify(packageJson, null, 2)); });
ul { list-style-type: none; padding: 0; }
function copyFieldToForm(source, hiddenForm) { var clone = source.clone(); source.after(clone).appendTo(hiddenForm); } copyFieldToForm($("#source"), $("#hiddenForm"));