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
// These values are specific to the problem I was solving | |
const GRID_SIZE = 6; | |
const BLOCK_CELL_INDICES = [[0, 6], [1, 2], [3, 4], [5, 11], [7, 13], [8, 14], [9, 15], [10, 16], | |
[12, 18], [17, 23], [19, 20], [21, 22], [24, 25], [26, 32], [27, 33], [28, 29], [30, 31], [34, 35]]; | |
const BLOCK_RULES = [[1, '-'], [3, '/'], [4, '-'], [4, '-'], [4, '-'], [1, '-'], [5, '+'], [2, '-'], [10, '*'], | |
[2, '-'], [2, '/'], [2, '-'], [6, '*'], [1, '-'], [3, '-'], [2, '/'], [4, '-'], [3, '-']]; | |
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.ComponentModel; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
public static class EnumHelper | |
{ | |
public static IDictionary<int, string> ToDictionary(this Type enumType) | |
{ |
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
ng lint | |
errorlevel=$? | |
if [ $errorlevel -ne 0 ] | |
then | |
echo "##teamcity[buildProblem description='Lint errors found, see Build Log for details']" | |
fi |
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
git config --global remote.origin.prune true | |
git config --global alias.lg "log --oneline --graph --decorate" | |
git config --global color.ui.auto true | |
git config --global color.status.added "green normal bold" | |
git config --global color.status.changed "red normal bold" | |
git config --global color.status.updated "green normal bold" | |
git config --global color.status.untracked "yellow normal bold" | |
git config --global color.branch.remote "red normal bold" | |
git config --global color.branch.local "magenta normal bold" | |
git config --global color.diff.old "red bold" |
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
String.prototype.cleanMoney = function() { | |
return this.replace('-', '').replace('£', '').replace(',', ''); | |
} | |
var csv = ''; | |
var trs = $('#filterable-ftb tr'); | |
for (var index = 1; index < trs.length; index++) { | |
var tr = trs[index]; | |
var col0 = $('td[headers=header-date]', tr).text().trim(); |
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 log4net.Appender; | |
using log4net.Core; | |
using log4net.Layout; | |
using Xunit.Abstractions; | |
public class TestOutputAppender : AppenderSkeleton | |
{ | |
private readonly ITestOutputHelper _xunitTestOutputHelper; |
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.Diagnostics; | |
using System.Collections.Generic; | |
namespace FlimFlan.Diagnostics | |
{ | |
public class ColorConsoleTraceListener : ConsoleTraceListener | |
{ | |
Dictionary<TraceEventType, ConsoleColor> eventColor = new Dictionary<TraceEventType, ConsoleColor>(); | |
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.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Configuration; | |
using System.Linq; | |
internal static class AppSettingsReader | |
{ | |
/// <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
public class ObjectFromNameValueCollectionConverter | |
{ | |
public static T CreateFromNameValueCollection<T>(NameValueCollection nameValueCollection, string keyPrefix = "") | |
where T : new() | |
{ | |
var target = new T(); | |
Type type = target.GetType(); | |
foreach (var key in nameValueCollection.AllKeys.Where(x => x.StartsWith(keyPrefix))) | |
{ | |
var propertyName = key.Substring(keyPrefix.Length); |
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
internal static System.Web.HttpContext FakeHttpContext() | |
{ | |
var httpRequest = new System.Web.HttpRequest("", "http://localhost/", ""); | |
var stringWriter = new System.IO.StringWriter(); | |
var httpResponse = new System.Web.HttpResponse(stringWriter); | |
var httpContext = new System.Web.HttpContext(httpRequest, httpResponse); | |
var sessionContainer = new System.Web.SessionState.HttpSessionStateContainer( | |
"id", new System.Web.SessionState.SessionStateItemCollection(), | |
new System.Web.HttpStaticObjectsCollection(), 10, true, |