$ docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Encodes the string using base64. | |
* @param {string|number} str - The string to encode. | |
* @returns {string} The base64-encoded string. | |
*/ | |
function base64encode(str) { | |
if (typeof str !== 'string') { | |
if (typeof str === 'number') { | |
str = str.toString(); | |
} else { |
FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//RegExp for URL validation - ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$ | |
let exp = ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$; | |
function testInfo(phoneInput) { | |
var OK = exp.exec(phoneInput.value); | |
if (!OK) | |
window.alert(phoneInput.value + ' isn\'t a phone number with area code!'); | |
else | |
window.alert('Thanks, your phone number is ' + OK[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function f() { | |
return 1; | |
} | |
f().then(alert); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var promise = new Promise(function(resolve, reject) { | |
throw new Error('Some error has occured') | |
}) | |
promise | |
.then(function(successMessage) { | |
console.log(successMessage); | |
}) | |
.catch(function(errorMessage) { | |
//error handler function is invoked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Gist Embed - Dark Theme Styling - Thanks to MattD */ | |
/* Body */ | |
.gist-data tbody { background-color: Black; } | |
/* Line Numbers */ | |
.gist-data tbody td:nth-of-type(1) { | |
color: #2B91AF !important; | |
} |