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
public class AntiForgeryTokenFilterProvider : IFilterProvider | |
{ | |
public IEnumerable<Filter> GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) | |
{ | |
IEnumerable<FilterAttribute> filters = actionDescriptor.GetFilterAttributes(true); | |
bool disableAntiForgery = filters.Any(f => f is DisableAntiForgeryCheckAttribute); | |
string method = controllerContext.HttpContext.Request.HttpMethod; |
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
/// <summary> | |
/// The multi assert. | |
/// </summary> | |
/// <remarks> | |
/// Sometimes in order to test one logical concern you need to use | |
/// multiple asserts. This class helps with that. | |
/// </remarks> | |
public static class MultiAssert | |
{ | |
/// <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
/* | |
* This work (Modern Encryption of a String C#, by James Tuley), | |
* identified by James Tuley, is free of known copyright restrictions. | |
* https://gist.github.com/4336842 | |
* http://creativecommons.org/publicdomain/mark/1.0/ | |
*/ | |
using System; | |
using System.IO; | |
using System.Text; |
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
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
REM This script must be run as Administrator | |
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
REM Create a CA Certificate and place it into Trusted Root Certificate authorities storage on local machine. | |
makecert -n "CN=Development Root CA" -r -pe -a sha512 -len 4096 -cy authority -sr localmachine -ss Root -sk "Development Root CA" | |
REM Create a dev Certificate and place it into Personal certificates on local machine. | |
makecert -pe -n "CN=*.dev.local" -a sha512 -len 2048 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -ir localmachine -is Root -in "Development Root CA" -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -sr localmachine -ss My -sk "*.dev.local" |
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
# | |
# Creates a website and an app pool in IIS. | |
# | |
function Create-IisSite | |
{ | |
param([string]$SiteName, [string]$Url, [string]$DirectoryPath, [string]$AppPoolDotNetVersion = "v4.0") | |
Import-Module WebAdministration | |
$iisAppPoolName = $SiteName |
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
# | |
# Creates a virtual directiry in the specified website. | |
# | |
function Create-IisVirtualDirectory | |
{ | |
param([string]$DirName, [string]$SiteName, [string]$DirectoryPath) | |
Import-Module WebAdministration | |
cd IIS:\ |
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
# | |
# Creates a record in host file. | |
# | |
function Register-Host | |
{ | |
param([string]$IpAddress = "127.0.0.1", [string]$Url) | |
$hostfile = "$env:SystemRoot\System32\drivers\etc\hosts" | |
$content = "$IpAddress $Url" | |
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.IO; | |
using System.Xml.Serialization; | |
namespace Common | |
{ | |
/// <summary> | |
/// XML Serialization utils. | |
/// </summary> | |
public static class XmlSerializer | |
{ |
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
#Add this into your local (.git/config) or global (%USER_HOME%/.gitconfig) git config file. | |
[diff] | |
tool = tgm | |
[difftool "tgm"] | |
cmd = \"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\" \"$LOCAL\" \"$REMOTE\" | |
[merge] | |
tool = tgm | |
[mergetool "tgm"] | |
cmd = \"C:\\Program Files\\TortoiseGit\\bin\\TortoiseGitMerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" |
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
-- This stored proc was developed based on the backup naming and folder convention from | |
-- https://ola.hallengren.com/ Maintenance Solution (as of 28 September, 2016). | |
-- It solely relies on files in the folder, it does not query MSDB, since it is | |
-- designed to work with Availability Groups (which may not have one single source of backup history). | |
-- Give it a database name and a backup root folder that you specified in Ola's Maintenance Solution script | |
-- and it will produce a sequence of RESTORE commands: | |
-- * Starting from MOST RECENT full backup, | |
-- * Then MOST RECENT diff backup (if exists) | |
-- * Then all T-Log backups after the last FULL/DIFF backup. |
OlderNewer