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
using System.Collections.Generic; | |
namespace ADL.TechPubs | |
{ | |
public interface IApplicationItems : IDictionary<string, object> | |
{ | |
bool Exists(string key); | |
object Get(string key); | |
T Get<T>(string key) where T : class; | |
} |
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
using System; | |
using System.ComponentModel.DataAnnotations; | |
namespace ADL.TechPubs.WebFramework.Attributes | |
{ | |
public class IsTrueAttribute : ValidationAttribute | |
{ | |
/// <summary> | |
/// Determines whether the specified value of the object is valid. | |
/// </summary> |
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
protected async Task DoSomething() | |
await Task.Run(() => | |
{ | |
Console.WriteLine("Hello World!"); | |
}); | |
} |
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
private IEnumerable<IEnumerable<T>> SplitIntoPages<T>(IEnumerable<T> items, int itemsPerPage) | |
{ | |
var pages = new List<List<T>>(); | |
int pageCount = (int)Math.Ceiling((items.Count() / (decimal)itemsPerPage)); | |
int skipCount = 0; | |
for (int i = 0; i < pageCount; i++) | |
{ | |
var subset = items.Skip(skipCount).Take(itemsPerPage).ToList(); | |
pages.Add(subset); | |
skipCount += itemsPerPage; |
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
# Retrieve the current release | |
$releaseUrl = ('{0}{1}/_apis/release/releases/{2}?api-version=5.0' -f $($env:SYSTEM_TEAMFOUNDATIONSERVERURI), $($env:SYSTEM_TEAMPROJECTID), $($env:RELEASE_RELEASEID) ) | |
$release = Invoke-RestMethod -Uri $releaseUrl -Headers @{ | |
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN" | |
} | |
# Set the relevant variables on the release | |
$release.variables."My.Test.Vari".value = "just a test" | |
$release.variables | Add-Member NoteProperty "My.Other.Test" ([PSCustomObject]@{value='test AGAIN'}) | |
$release.variables | Add-Member NoteProperty "Agent.BakFileToRestoreFrom" ([PSCustomObject]@{value='$(Agent.Output.DatabaseBakFileLocation)'}) |
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
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$file, | |
[Parameter(Mandatory=$False)] | |
[string]$fileNameOverride = "", | |
[Parameter(Mandatory=$False)] | |
[boolean]$appendDateTime = $False, | |
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
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$directory, | |
[Parameter(Mandatory=$False)] | |
[string]$backupDirectory = "C:\Backups\", | |
[Parameter(Mandatory=$False)] | |
[boolean]$zip = $False, | |
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
Param( | |
# The bak file from which the restore will be performed | |
[Parameter(Mandatory=$True)] | |
[string]$file, | |
# The directory where the databse files (MDF and LDF) will be saved/restored to | |
[Parameter(Mandatory=$True)] | |
[string]$directory, | |
# The name of the database that is being restored |
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
using System; | |
namespace Xrisdoc.Extensions | |
{ | |
public static class DateTimeExtensions | |
{ | |
/// <summary> | |
/// Identifies whether or not the specified period is a monthly period | |
/// </summary> | |
/// <param name="startDate">The start date of the period</param> |
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-Module -Name D:\Temp\ACME-posh\ACMEPowerShell.psd1 | |
$domain = "mydomain.com" | |
$certificiatePassword = "abcd1234" | |
$email = "letsencrypt@mydomain.com" | |
$vault = "D:\Vault\{0}\{1}" -f $domain, [guid]::NewGuid() | |
mkdir $vault | |
cd $vault | |
Initialize-ACMEVault -BaseURI https://acme-v01.api.letsencrypt.org/ | |
New-ACMERegistration -Contacts mailto:$email |
NewerOlder