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
class Day4_2018 { | |
const string INPUTFILE = @"2018\day4.txt"; | |
public void Part1() { | |
var guardSleepMinutes = LoadGuardSleepMinutes(); | |
var guardSleepTotals = new Dictionary<int, int>(); | |
foreach (var guard in guardSleepMinutes) { | |
if (!guardSleepTotals.ContainsKey(guard.Key)) { |
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
class Day3_2018 { | |
const string INPUTFILE = @"2018\day3.txt"; | |
public void Part1() { | |
var input = File.ReadAllLines(INPUTFILE); | |
var dimension = 1000; | |
var area = dimension * dimension; | |
var fabric = new int[area]; |
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
class Day2_2018 { | |
const string INPUTFILE = @"2018\day2.txt"; | |
public void Part1() { | |
var input = File.ReadAllLines(INPUTFILE); | |
var twos = 0; | |
var threes = 0; | |
foreach (var line in input) { |
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
class Day1_2018 { | |
public void Part1() { | |
var input = File.ReadAllLines(@"2018\day1.txt"); | |
var output = 0; | |
foreach (var line in input) { | |
var number = Convert.ToInt32(line); | |
output += number; | |
} |
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
javascript:void(open('https://archive.today/?run=1&url='+encodeURIComponent(document.location))) | |
javascript:void(window.open('https://outline.com/'+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
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] | |
public class PreventDuplicateRequestAttribute : ActionFilterAttribute { | |
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { | |
if (context.HttpContext.Request.Form.ContainsKey("__RequestVerificationToken")) { | |
await context.HttpContext.Session.LoadAsync(); | |
var currentToken = context.HttpContext.Request.Form["__RequestVerificationToken"].ToString(); | |
var lastToken = context.HttpContext.Session.GetString("LastProcessedToken"); | |
if (lastToken == currentToken) { |