This is not running yet, but nearly almost
First install a WSL2 with Ubuntu 20.04 as described at Microsoft
Enter wsl shell
This is not running yet, but nearly almost
First install a WSL2 with Ubuntu 20.04 as described at Microsoft
Enter wsl shell
| //Question: if you have a function which may or may not do some async, do you use a promise for the non-async path? | |
| //Option A: Only return promise when doing async: | |
| function OptionA(input){ | |
| if ( requiresQuery() ){ | |
| var defer = Q.deferred(); | |
| $.ajax()... | |
| .done(function(asyncData){ | |
| defer.resolve(asyncData); | 
| //This little snippet does the bad practice of overloading default JavaScript objects. I know it's bad taste, sue me. | |
| //It only works on arrays. | |
| //['a', 'b', 'c'].randomElement() | |
| Object.prototype.randomElement = function(){ | |
| var randomIndex = Math.floor(Math.random() * this.length); | |
| return randomString = this[randomIndex]; | |
| } |