To Generate UUID function generateUUID() { var d = new Date().getTime(); var uuid = ‘xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx’.replace(/[xy]/g, function(c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c == ‘x’ ? r : (r & 0x3 | 0x8)).toString(16); }); return uuid; } Sample output : 48808c28-24e0-4081-be13-2c27948bfa27 Extract …
The below directive creates a scroll to top icon on the bottom right corner of the page. On click it will smoothly scroll you position back to top. Angular Directive: function ScrollToTop() { return { template: “<a ng-click=’click()’ class=’scroll-to-top-anchor’></a>”, replace: true, scope: true, controller: function($scope) { $scope.click = function() { var startY = currentYPosition(); var stopY …
Lets say I give you a print out of Professor Albert Einstein’s Wikipedia page and tell you that I am going to ask you questions from that text. You will have enough time to read through the document and find the answers that I am looking for. Assuming you are good at finding answers, here is …
What is Base64? Base64 is a generic term for a number of similar encoding schemes that encode binary data by treating it numerically and translating it into a base 64 representation. The Base64 term originates from a specific MIME content transfer encoding. Base64 encoding schemes are commonly used when there is a need to encode …
As I stood there watching those drops falling downhill, I could feel how powerful they are, with no beginning, with no end, they are moving like they don’t care about who is watching them. The serenity, the peacefulness in the noise of the fall is something I could give away anything in the world for. 180 away from the …
The simplest way of rendering a variable is using the scriptlets, similar to the ones used in JSPs <%= variable %> But if you want your code to be rendered or executed but not printed then render it like this: <% variable %> If you want your code to be evaluated as well as rendered (ex: variables containing …
Many times you would like to render the array contents in reverse when using ng-repeat. You can do that with a simple single line code which uses the slice and reverse method. <tr ng-repeat=”subs in subjects.slice().reverse()”> </tr> The disadvantage to this way of printing the data is that the original array contents get reversed taking up your …
As of writing this article the latest node version was 4.2.4, you can install this one using the distribution from NodeSource repository: sudo apt-get install curl curl –silent –location https://deb.nodesource.com/setup_4.x | sudo bash – sudo apt-get install nodejs You can find all the sources here, https://github.com/nodesource/distributions/tree/master/deb Then, you have the latest version of node.js installed.
Parkinson’s law states that work expands to fill the time available to complete it . Can you think back to the fifth grade when the teacher gave you three months to complete your report? You probably could have done that in a week but instead you waited till the last day and were trying to …