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> | |
/// 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); | |
} |
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> | |
/// 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 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 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 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 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 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 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 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
dmfI1aqibQuTiuOCjuOYNqqPAuuiNIc1QeOIxjqvZscDlsAxus)cbLmmj4yuQwMGQNHGQPHsLRjaTnbW3qH04iLQohPuzDOqmpusLUhPyFKsjhebSquk9qsKjIsYfjLSruk(ikv1ijLsDssuRerVebLYmfuUjkvzNOGFIsmubIJkqLYsfqpLitfHUkPuSvuOkFfbfNfLuXBrGUlcYEPQ)kidgomQwmj0JjvtMOUSuBMs5ZOOrtbNwsRgLu1RjbMTOUTeTBH(TidNqwovEobthPRtrBNs8Dusz8KGopHA9Oqv9EbkZxGk5(cK2VAVDprVe3t0t9scEPWTs4wlyTGxQ0lj7LK9e9smDjwZlPnbXlPqwSztOPEgulynGEjXSyZMqt9mOs4fiCVexNwT0eDvMmBh7LKBpdQ2l4LeeX1Bpd29scD2wqs1i1lXwwisKf2ZlzORmnq9SHDmQ2hWcmQ2R9AN2vGDAp7yN27TPYoT3lLtCzprVeLN7i1t0lvAMPvprp1t9sYvB2Q6MzQyprVuPzMw9e9up1l5s52t0lvAMPvprp1t9s2460Ak6j6LknZ0QNON6PEjrwer55os9e9sLMzA1t0t9uVKJR3EIEPsZmT6j6PEQxYuOdPN5ccEf9uVKRzwtrIIf1EjzXrEzvNPlzkYlzqSIUQCqscvAnf9sgeRORkhgxG6LesoQxYGyfDvzVuRqr8OCl7zRxsXKtUDSyZMqt9my3lXLLR0AkYZHOUktMTtWt0t9svzVeRkzsuSOwWlzqSIUQSuYrzVKC7LKBb9okxJm9sYvbwVzuNwT0EjEo7LIMLeDvMmBNGNb7EjwRktn4zd7cybcpafSZOmk70(aYo7SJDEBQSlGEQxs3t0ZGDprVKIjNC7ukLtoprpd29muWZq4Egk4zGW9muWZa78my3t9sCDAnff8e9s1yL6j6LKtH0nfOPspB9s6Mc0uPxsvvvvvvvvvvvvvvvvvvvDsv1HsSWaBuM9hSeeIkZcdsdv1jvvvvvvvvvvvvvv |
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 TempTracker | |
{ | |
// For mode | |
// Array of 0s at indices 0..110 | |
private readonly int[] _occurrences = new int[111]; | |
private int _maxOccurrences; | |
// For mean | |
private int _totalNumbers; |
OlderNewer