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
const args = Object.fromEntries( | |
process.argv.slice(2).map((arg) => { | |
const [key, value] = arg.split('=') | |
return [key.slice(2), value] | |
}) | |
) | |
// input: --port=3000 --out=dist | |
// output: { port: '3000', out: 'dist' } |
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
import { unindent, repeat, truthy } from "template-helpers"; | |
function createMessage(user, notifications) { | |
return unindent(truthy` | |
Hello, ${ user.name }! | |
${(notifications.length > 0) && truthy` | |
You have ${ notifications.length } new notification${ (notifications.length > 1) && "s" }. | |
${repeat(notifications, notification => truthy` | |
* ${ notification.title } ${ notification.important && "!" } | |
`)} |
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
workflow PingUrlParallel { | |
param( | |
[string]$url, | |
[int]$parallelCount = 10, | |
[int]$iterations = 10 | |
) | |
foreach -parallel ($x in 1..$parallelCount) { | |
1..$iterations | %{ |
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 spawn = require("child_process").spawn; | |
var Q = require("q"); | |
/** | |
* Wrap executing a command in a promise | |
* @param {string} command command to execute | |
* @param {Array<string>} args Arguments to the command. | |
* @param {string} cwd The working directory to run the command in. | |
* @return {Promise} A promise for the completion of the command. | |
*/ |