NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| import base64 | |
| # Creating a string | |
| s = "test" | |
| # Encoding the string into bytes | |
| b = s.encode("UTF-8") | |
| # Base64 Encode the bytes | |
| e = base64.b64encode(b) | |
| # Decoding the Base64 bytes to string | |
| s1 = e.decode("UTF-8") | |
| # Printing Base64 encoded string |
| { | |
| "name": "my-app", | |
| "version": "0.0.0", | |
| "devDependencies": { | |
| "browserify": "^10.2.4", | |
| "watchify": "^3.2.3", | |
| "node-sass": "^3.2.0", | |
| "uglify": "^2.4.23", | |
| "mkdirp": "^0.5.1", | |
| "parallelshell": "^1.2.0", |
| $.ajax({ | |
| url: '/echo/error/', | |
| async: true, | |
| // retryCount and retryLimit will let you retry a determined number of times | |
| retryCount: 0, | |
| retryLimit: 10, | |
| // retryTimeout limits the total time retrying (in milliseconds) | |
| retryTimeout: 10000, | |
| // timeout for each request | |
| timeout: 1000, |