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; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace Devlord.Utilities | |
{ | |
/// <summary> | |
/// Use for designing a business rule where conditions are evaluated and the actions are executed based on the evaluation. | |
/// Rules can be chained by setting the "Action" as another business rule. |
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
function Prune-Branches | |
{ | |
git branch --merged | ForEach-Object { $_.Trim() } | | |
Where-Object {-not ( $_ -Like "*master" )} | Where-Object {-not ( $_ -Like "*develop" )} | ForEach-Object { git branch -d $_.Replace('origin/', '') } | |
} |
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
<% | |
' Use with a very short session (basically the page lifecycle, GET then POST) | |
Class AntiForgeryValidator | |
Private m_securityToken | |
Sub SetCookie() | |
m_securityToken = CreateWindowsGuid() | |
Response.Cookies("RequestVerificationToken") = m_securityToken |
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.Text.RegularExpressions; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Serialization; | |
namespace Test | |
{ | |
public class FooTest | |
{ | |
public void TestCustomResolver() | |
{ |
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
/** | |
* Parse hash bang parameters from a URL as key value object. | |
* | |
* #x&y=3 -> { x:null, y:3 } | |
* | |
* @param aURL URL to parse or null if window.location is used | |
* @return Object of key -> value mappings. | |
*/ | |
function parseHashBang(url) { | |
url = url || window.location.href; |
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.Linq; | |
using System.Text; | |
namespace EntityExtensions { | |
public class FakeDbSet<T> : System.Data.Entity.IDbSet<T> where T : class { | |
private readonly List<T> list = new List<T>(); | |
public FakeDbSet() { |
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
/// <summary> | |
/// Speeds up DAL development by reducing repeated code. | |
/// </summary> | |
private void OpenConnectionAndDispose(string storedProcedure, Action<SqlCommand> action) | |
{ | |
using (var conn = new SqlConnection(connectionString)) | |
{ | |
using (var command = new SqlCommand(query, conn)) | |
{ | |
command.CommandType = CommandType.StoredProcedure; |
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
/// <summary> | |
/// Enforces a rule that a collection can perform a certain action on each of its items. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
public interface IEachified<T> | |
{ | |
void ForEach(Action<T> action); | |
} |
NewerOlder