ls <path> | ?{$_.Name -match "^$"}
is shorthand for
Get-Child <path> | Where-Child {$_.Name -match "^$"}
in powershell.
Versus
perl -le"foreach (){if(m/^$/){print $_ } }"
| const path = require('path'); | |
| const util = require('util'); | |
| const { createLogger, format, transports } = require('winston'); | |
| const { combine, timestamp, label, printf } = format; | |
| const myFormat = printf(info => { | |
| info.label = info.label.padStart(5,' '); | |
| info.level.padStart(7,' '); | |
| let re = /[\r\n]+/; | |
| if(typeof info.message === "object") |
| $ArrayList = [System.Collections.ArrayList]@() | |
| # Note: this scripts searches for folders named "Single" recursively from the starting folder. | |
| Get-ChildItem -Path .\ -Recurse | Where-Object { | |
| $_ -is [System.IO.FileInfo] ` | |
| -and ($_.Directory.Name -eq 'Single') | |
| } | ForEach-Object { | |
| $ArrayList.add($_.FullName) | |
| } | |
| # Threaded task to use pdfk to get files. |
| (function(){ // Generator Promise For Loop | |
| let getFiringResult = delay => new Promise((o,x)=>setTimeout(()=>o(Math.random()),delay)); | |
| const fireCannons = (function* (data){ | |
| let index = 0; | |
| while(index<5){ | |
| index++; | |
| yield getFiringResult(1000); | |
| } | |
| return; |
| // Not sure this is accruate, but I was wondering about different styles. | |
| (function(){ | |
| let sum = e=>e+1; | |
| let sub = e=>e-1; | |
| let mul = e=>e*e; | |
| let div = e=>1/e; | |
| let dataSet = [1,2,3]; | |
| let dataSet2 = [4,5,6]; | |
| console.log([...Array((127-32)).keys()].map(e=>String.fromCharCode(e+32)).join('')) |
| await execFile(GHOST_SCRIPT_PATH,[ | |
| `-q`,`-dNOPAUSE`, `-dBATCH`,`-dSAFER `, | |
| `-sDEVICE=pdfwrite`, | |
| `-dCompatibilityLevel=1.3`, | |
| `-dPDFSETTINGS=/screen `, | |
| `-dEmbedAllFonts=true`, | |
| `-dSubsetFonts=true`, | |
| `-dColorImageDownsampleType=/Bicubic`, | |
| `-dColorImageResolution=300`, | |
| `-dGrayImageDownsampleType=/Bicubic`, |
| Function encodeURIComponent(strText As String) As String | |
| Static objHtmlfile As Object | |
| If objHtmlfile Is Nothing Then | |
| Set objHtmlfile = CreateObject("htmlfile") | |
| ' objHtmlfile.parentWindow.execScript "function encode(s) {return encodeURIComponent(s)}", "jscript" | |
| End If | |
| encodeURIComponent = objHtmlfile.parentWindow.encodeURIComponent(strText) | |
| End Function | |
| Function decodeURIComponent(strText As String) As String |
ls <path> | ?{$_.Name -match "^$"}
is shorthand for
Get-Child <path> | Where-Child {$_.Name -match "^$"}
in powershell.
Versus
perl -le"foreach (){if(m/^$/){print $_ } }"
| (function (){ | |
| const double = (x) => x*2 | |
| const output = [1,2,3].map(double); | |
| console.log(output) // [2,4,6] | |
| // Currying | |
| const mult = (i) => (x) => x*i | |
| let aMod = (arr) => (mult) => arr.map(mult); | |
| const arr = [1,2,3]; | |
| console.log(aMod(arr)(mult(2))); |
| $ArrayList = [System.Collections.ArrayList]@() | |
| Get-ChildItem -Path .\ -Recurse | Where-Object { | |
| $_ -is [System.IO.FileInfo] ` | |
| -and ($_.Extension.ToLower().CompareTo('.pdf') -eq 0) ` | |
| -and ($_.name.CompareTo('out.pdf') -ne 0) | |
| } | ForEach-Object { | |
| $ArrayList.add($_.FullName) | |
| } | |
| workflow Test-Workflow{ |