Skip to content

Instantly share code, notes, and snippets.

https://codepen.io/zenius/pen/qGgobQ
https://code.visualstudio.com/docs/setup/linux
The repository and key can be installed manually with the following script:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
Then update the package cache and install the package using:
sudo apt-get install apt-transport-https
sudo apt-get update
https://github.com/chrisyip/koa-pug#basedir
basedir
If you encounter this error, Error: the "basedir" option is required to use "extends" with "absolute" paths, try to set basedir like this:
const pug = new Pug({
viewPath: 'path/to/views',
basedir: 'path/for/pug/extends'
})
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
Isolating scope is recommend for passing data between custom directive and its parent scope to prevent unintentionally changing the parent scope.
https://medium.com/@tpstar/angularjs-custom-directive-and-isolated-scope-how-to-pass-data-to-and-from-directive-scope-dd0bc8096bf9
https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
https://www.tutlane.com/tutorial/angularjs/angularjs-apply-function
$scope.$apply(function () {
//Your Code.
});
Different ways to use '$apply()'
1.
$scope.$apply(function () {
$scope.val1 = 'tutlane.com';
https://docs.angularjs.org/api/ng/service/$compile
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
// Save data to sessionStorage
sessionStorage.setItem('key', 'value');
// Get saved data from sessionStorage
let data = sessionStorage.getItem('key');
// Remove saved data from sessionStorage
sessionStorage.removeItem('key');
<form name="myForm">
<label>
User name:
<input type="text" name="userName" ng-model="user.name" required>
</label>
<span class="error" ng-show="myForm.userName.$error.required"> Required!</span>
<label>
Last name:
<input type="text" name="lastName" ng-model="user.last" ng-minlength="3" ng-maxlength="10">
</label>