Skip to content

Instantly share code, notes, and snippets.

@KennyBu
KennyBu / Setting up SourceGear DiffMerge for Git.md
Created October 24, 2015 18:37 — forked from mkchandler/Setting up SourceGear DiffMerge for Git.md
Setup guide for making Git recognize and use SourceGear DiffMerge.
  1. Download SourceGear DiffMerge: http://sourcegear.com/diffmerge/index.html

  2. Add the following to your global .gitconfig file:

     [diff]
         tool = DiffMerge
     [difftool "DiffMerge"]
         cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' "$LOCAL" "$REMOTE"
     [merge]
    

tool = DiffMerge

@KennyBu
KennyBu / HelloWorldTest.cs
Created October 19, 2015 12:26
Shouldly Example
[Fact]
public void IntTest()
{
const int value = 5;
value.ShouldBe(5);
value.ShouldBeGreaterThan(4);
value.ShouldBeGreaterThanOrEqualTo(5);
value.ShouldBeInRange(0, 10);
value.ShouldBeLessThan(6);
@KennyBu
KennyBu / Restsharp.cs
Created August 25, 2015 13:47
Restsharp Asyc Await
using System;
using System.Threading;
using System.Threading.Tasks;
using RestSharp;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
@KennyBu
KennyBu / gist:9cf220ce272b28d9bb97
Created April 2, 2015 15:17
Action Filter IsChildAction
public class Class1 : IActionFilter
{
public void OnActionExecuting(ActionExecutingContext filterContext)
{
if(filterContext.IsChildAction)
{
//Your Code Goes Here
}
}
@KennyBu
KennyBu / gist:5ac6831680cc9772d4db
Created April 1, 2015 13:45
Determine installed PowerShell version
$PSVersionTable.PSVersion
@KennyBu
KennyBu / gist:2b9f8b7deb17a689b753
Created December 10, 2014 18:16
Import Data Into SQL from File
IF OBJECT_ID('tempdb..#test1') IS NOT NULL
DROP TABLE #test1;
GO
--temp table with text fields
CREATE TABLE #test1
(
Id varchar(500) NOT NULL,
)
@KennyBu
KennyBu / gist:c7b08be0d5b19e752723
Created December 4, 2014 16:45
Windows Firewall
To Turn Off:
NetSh Advfirewall set allprofiles state off
To Turn On:
NetSh Advfirewall set allrprofiles state on
To check the status of Windows Firewall:
Netsh Advfirewall show allprofiles
@KennyBu
KennyBu / gist:d9479a454e81e16df668
Created October 29, 2014 18:05
NServiceBus Return to Queue
ReturnToSourceQueue.exe
C:\Program Files (x86)\Particular Software\NServiceBus\v4.4\Tools>ReturnToSourceQueue.exe
@KennyBu
KennyBu / Retry.cs
Created October 24, 2014 13:37
C# Retry
public static class Retry
{
public static void Do(
Action action,
TimeSpan retryInterval,
int retryCount = 3)
{
Do<object>(() =>
{
action();
@KennyBu
KennyBu / gist:b58824eb5248ea845038
Last active August 29, 2015 14:07
PetaPoco Querying a VARCHAR Column
//AnsiString will tell SQL Server it's a VARCHAR not a NVARCHAR
//Standard Fetch
const string billingEmail = "blah@gmail.com";
var db = new Database(ManagerTestsHelper.GetConnectionString(), "System.Data.SqlClient");
var customers = db.Fetch<Customer>("WHERE BillingEmail=@0", new AnsiString(billingEmail));
//Scalar Query