-i - ignore errors
-c - continue
-t - use video title as file name
--extract-audio - extract audio track
| // Variables used by Scriptable. | |
| // These must be at the very top of the file. Do not edit. | |
| // icon-color: green; icon-glyph: file-code; | |
| const getString = importModule('getString'); | |
| const documentDirectory = FileManager.iCloud().documentsDirectory(); | |
| const header = `// Variables used by Scriptable. | |
| // These must be at the very top of the file. Do not edit. | |
| // icon-color: deep-gray; icon-glyph: file-code;`; |
| // Variables used by Scriptable. | |
| // These must be at the very top of the file. Do not edit. | |
| // icon-color: green; icon-glyph: file-code; | |
| const getModule = importModule("getModule"); | |
| const documentDirectory = FileManager.iCloud().documentsDirectory(); | |
| module.exports = async ({ moduleName, url, forceDownload = false }) => { | |
| if (moduleExists(moduleName) && !forceDownload) { | |
| return importModule(moduleName); |
| # Create a new repository on the command line | |
| touch README.md | |
| git init | |
| git add README.md | |
| git commit -m "first commit" | |
| git remote add origin https://github.com/c0ldlimit/vimcolors.git | |
| git push -u origin master | |
| # Push an existing repository from the command line |
#Quick Guide
sudo atsutil databases -remove
atsutil server -shutdown
atsutil server -ping
#Extended Guide from http://doc.extensis.com/Font-Management-in-OSX-Best-Practices-Guide.pdf
| // Variables used by Scriptable. | |
| // These must be at the very top of the file. Do not edit. | |
| // icon-color: gray; icon-glyph: magic; | |
| // Defaults to the latest version and no automatic update; if the file exists, just use it | |
| const moment = await require('moment'); | |
| // Use any SemVer options to specify a version you want | |
| // Refer to the calculator here: https://semver.npmjs.com/ | |
| const lodash = await require('lodash@^3.9.1'); |
I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.
Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:
fetch("/api/foo")
.then( response => {
if (!response.ok) { throw response }
return response.json() //we only get here if there is no error
})
| // Builds array of everything ahead of time | |
| function collectAllItems() { | |
| return [calculateFirst(), calculateSecond(), ...] | |
| } | |
| // This loop will end as soon as `isMatch(item)` is truthy. | |
| // If the very first item in the array is a match, then we | |
| // wasted all this time building the array in the first place. | |
| for (let item of collectAllItems()) { | |
| if (isMatch(item)) { |
| # Puma occasionally doesn't kill all ruby processes when | |
| # I shut down my local web server. Here are the steps | |
| # to find and kill the processes. | |
| # Find pid of process running on specified port | |
| lsof -i :3000 | |
| # Kill process | |
| sudo kill -9 [pid] |
| // I see this mistake often (and have made it myself before) | |
| // What's the bug with this function? | |
| function isFavSeason(season) { | |
| return season === 'spring' || 'summer' ? 'yes' : 'no' | |
| } | |
| // Let's try it and find out | |
| console.log(isFavSeason('spring')) // yes | |
| console.log(isFavSeason('summer')) // yes |