- Errors can be handled in a synchronouse fashion
- You can throw an exception in a Promise
- You can reject a promise with an exception
- You can catch an exception with Promise catch
This file contains hidden or 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
| function log(value, label = "-") { | |
| console.log(" "); | |
| console.log(" "); | |
| console.log(label, JSON.stringify(value, null, " ")); | |
| } |
This file contains hidden or 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
| # Run Chrome as IE11 | |
| "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; Ypkch32; rv:11.0) like Gecko" |
This file contains hidden or 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
| // Based on material css | |
| .container { | |
| margin: 0 auto; | |
| .row { | |
| margin-left: -4px; | |
| margin-right: -4px; | |
| } | |
| } | |
| .row { |
This file contains hidden or 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
| // the first five are the G5 currencies. The whole lot are the G10 | |
| const currencies = ["EUR", "GBP", "YEN", "USD", "CHF", "AUD", "CAD", "NZD", "NOK", "SEK"]; |
This file contains hidden or 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
| cat test-file.js | grep "\(it(\|describe(\)" |
This file contains hidden or 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
| find . -type f -print0 | xargs -0 grep -l "needle" |
This file contains hidden or 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
| const fs = require("fs"); | |
| const path = require("path"); | |
| const PATH = "." | |
| function listDirs(files) { | |
| files.forEach(file => { | |
| fs.stat(path.join(PATH, file), (err, stats) => { | |
| if (stats.isDirectory()) { | |
| console.log(file); |
This file contains hidden or 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
| # Unix find documentation: https://kb.iu.edu/d/admm | |
| # Remove all node_modules that were modified 60 days or earlier (to free up disc space) | |
| find ./* -maxdepth 1 -path '*node_modules*' -type d -mtime +60 -exec rm -rf {} \; | |
| # Show all directories containing node_modules that were modified 60 days or earlier | |
| find ./* -maxdepth 1 -path '*node_modules*' -type d -mtime +60 -print | |
| # Run this script where all the checked out projects are. | |
| find . -maxdepth 2 -type d -ctime +60 -name node_modules | grep -vE "(node-deploy|node-release|stash-client|kibana-dashboards|package-manager)" | xargs rm -rf |