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
# | |
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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
@(echo off) > $null | |
if #ftw NEQ '' goto :init | |
($true){ $Error.clear(); } | |
# unpack arguments if they came from CMD | |
$hash=@{}; | |
get-item env:argz* |% { $hash[$_.name] = $_.value } | |
if ($hash.count -gt 0) { | |
$args=for ($i=0; $i -lt $hash.count;$i++) { $hash["ARGZ[$i]"] } | |
} |
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
@(echo off) > $null | |
set null( New-Module -ScriptBlock { function goto { }; function :{ } } )#= | |
: # This file is both a .cmd script and a powershell script. if you save it as | |
: # sample.cmd and run it it from cmd.exe it will run the same as if you | |
: # saved it as sample.ps1 and run it. | |
: # well, in this case, I added some echos on the cmd side... | |
goto :CMDSTART |
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
Set-ExecutionPolicy -Scope LocalMachine Unrestricted -force | |
$ProgressPreference=0 | |
function ResolvePath { | |
param ( | |
[string] $FileName | |
) | |
$FileName = Resolve-Path $FileName -ErrorAction SilentlyContinue ` | |
-ErrorVariable _frperror |
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
Object.defineProperties(Array.prototype, { | |
where: { value: Array.prototype.filter }, | |
select: { value: Array.prototype.map }, | |
any: { value: Array.prototype.some }, | |
all: { value: Array.prototype.every }, | |
insert: { value: function (position: number, items: Array<any>) { return (<Array<any>>this).splice(position, 0, ...items); } }, | |
selectMany: { value: function (callbackfn: (value: any, index: number, array: Array<any>) => Array<any>) { return (<Array<any>>this).select(callbackfn).flat(); } }, | |
groupByMap: { value: function (keySelector: (each: any) => any, selector: (each: any) => any) { | |
const result = new Map<any, Array<any>>(); |
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 identifier = "SomethingNOTGarrettButTLAsInASetOfEverLongerWordsTLAWithIsOfAPIsAPIssNotNOManThatYouUseWith_a_TLA"; | |
// split identifier into words | |
identifier.replace(/([a-z]+)([A-Z])/g, '$1 $2'). | |
replace(/(\d+)/g, ' $1 '). | |
replace(/\b([A-Z]+)([A-Z])s([^a-z])(.*)/g, '$1$2« $3$4'). | |
replace(/\b([A-Z]+)([A-Z])([a-z]+)/g, '$1 $2$3'). | |
replace(/«/g, 's').trim(). | |
split(/[\W|_]+/) | |
// returns: |
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
# | |
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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
<# | |
.SYNOPSIS | |
Creates a new alias. Better than original New-Alias | |
.DESCRIPTION | |
Creates a new Function Alias. Unlike the original New-Alias, this will let you | |
create an alias that can be a command line or script, in a single command. |
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
{ | |
"globals": { | |
"alwaysShowTabs": true, | |
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44b0}", | |
"initialCols": 160, | |
"initialRows": 50, | |
"keybindings": [ | |
{ | |
"command": "closePane", | |
"keys": [ |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- @FearTheCowboy's Simple PowerShell Task for MSBuild --> | |
<UsingTask TaskName="PowerShell" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"> | |
<ParameterGroup><ScriptBlock ParameterType="System.String" Required="true" /></ParameterGroup> | |
<Task><Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"/><Code Type="Class" Language="cs"><![CDATA[ | |
public class PowerShell : Microsoft.Build.Tasks.Exec { | |
public string ScriptBlock {set { EchoOff=true; Command = string.Format( "@powershell \"Invoke-Command -ScriptBlock {{ $errorActionPreference='Stop'; {0} ; exit $LASTEXITCODE }} \"", value.Replace("\"","\"\"").Replace("\r\n",";").Replace("\n",";").Replace("\r",";")); } } | |
}]]></Code></Task> | |
</UsingTask> |