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
public static IEnumerable<T[]> Chunk<T>( this T[] source, int size ) | |
{ | |
var acc = new List<T>( size ); | |
for ( var i = 0; i < source.Length; i++ ) | |
{ | |
acc.Add( source[i] ); | |
if ( acc.Count < size && i < source.Length - 1 ) | |
continue; | |
yield return acc.ToArray(); | |
acc.Clear(); |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net.Mail; | |
using NUnit.Framework; | |
using RemoteX.Libraries.ClientDataAccess.Entities.DTO; | |
using RemoteX.Libraries.Integration; | |
using RemoteX.Libraries.Integration.Testing; | |
using Should; |
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
param( $logsDirectory, $compressionDirectory ) | |
$ScriptDir = $MyInvocation.MyCommand.Path | split-path | |
# https://github.com/remotex/Scripts/tree/master/Windows | |
Set-Alias enableFeature $ScriptDir\Enable-WindowsFeature.ps1 | |
$wantedFeatures = @() | |
# install IIS Role | |
$wantedFeatures += "IIS-WebServerRole" | |
$wantedFeatures += "IIS-WebServer" |
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
param( | |
[string] $foo, | |
[int] $bar | |
) | |
$arguments = "" | |
# Change to $PSBoundParameters.. | |
$MyInvocation.BoundParameters.Keys | %{ | |
Write-Host "key $_" | |
# $MyInvocation.BoundParameters.Item( string key ) fails in PowerShell 3.0: | |
# $paramValue = $MyInvocation.BoundParameters.Item( $_ ) |
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
param( | |
[parameter(mandatory=$true, valuefrompipeline=$true)] | |
$TargetHost, | |
[switch] $force | |
) | |
begin { | |
$packages = @( ` | |
@{ Name = "rewrite.msi"; Url = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi" }, ` | |
@{ Name = "webpi.msi"; Url = "http://download.microsoft.com/download/B/0/0/B00FEF21-79DE-48B0-8731-F9CFE70CE613/WebPlatformInstaller_3_10_amd64_en-US.msi" }, ` | |
@{ Name = "webfarm.msi"; Url = "http://download.microsoft.com/download/3/4/1/3415F3F9-5698-44FE-A072-D4AF09728390/webfarm_amd64_en-US.msi" }, ` |
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
using System; | |
using System.Collections.Generic; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace WordWrapSnippet | |
{ | |
[TestClass] | |
public class WordWrapTests | |
{ | |
public static List<string> WordWrap( string text, int maxLineLength ) |
NewerOlder