I hereby claim:
- I am csuzw on github.
- I am csuzw (https://keybase.io/csuzw) on keybase.
- I have a public key ASCRAdPs2_BCK9ur7mkddBoPT03Wpqh_eNGaF4cuhcDPDQo
To claim this, I am signing this object:
// This goes in cypress/plugins/index.js | |
const AzureAdSingleSignOn = require('./azure-ad-sso/plugin').AzureAdSingleSignOn | |
module.exports = (on, config) => { | |
on('task', {AzureAdSingleSignOn:AzureAdSingleSignOn}) | |
} |
I hereby claim:
To claim this, I am signing this object:
int HighEntropyPassphrasesPartOne(string[] passPhrases) | |
{ | |
return DoHighEntropyPassphrases(passPhrases, w => w); | |
} | |
int HighEntropyPassphrasesPartTwo(string[] passPhrases) | |
{ | |
return DoHighEntropyPassphrases(passPhrases, w => string.Concat(w.OrderBy(c => c))); | |
} |
int SpiralMemoryPartOne(int location) | |
{ | |
if (location <= 1) return 0; | |
var ring = 1; | |
var max = 9; | |
while (max < location) | |
{ | |
ring += 1; | |
max += (((ring + 1) * 2) - 2) * 4; |
int CorruptionChecksumPartOne(int[][] input) | |
{ | |
return input.Sum(r => | |
{ | |
(var max, var min) = r.Aggregate((max: int.MinValue, min: int.MaxValue), (acc, i) => (i > acc.max ? i : acc.max, i < acc.min ? i : acc.min)); | |
return max - min; | |
}); | |
} | |
int CorruptionChecksumPartTwo(int[][] input) |
int InverseCaptchPartOne(string input) | |
{ | |
return DoInverseCaptcha(input, _ => 1); | |
} | |
int InverseCaptchPartTwo(string input) | |
{ | |
return DoInverseCaptcha(input, x => x.Length / 2); | |
} |
int GetKeyPresses(string message) | |
{ | |
return (int)message.Select(c => c < 83 ? ((c - 29) % 3) + 1 : Math.Round(Enumerable.Range(0, 8).Zip(new[] { -400129224492.361d, 32421475419.7348d, -1125710194.76048d, 21711311.9794762d, -251208.877408241d, 1743.70653338347d, -6.72322436313127d, 0.011108192375644d }, (a, b) => b * Math.Pow(c, a)).Sum())).Sum(); | |
} |
public int DateDiff(int y1, int m1, int d1, int y2, int m2, int d2) | |
{ | |
return GetDays(y2, m2, d2) - GetDays(y1, m1, d1); | |
} | |
private int GetDays(int y, int m, int d) | |
{ | |
var y1 = y - 1; | |
var m1 = m - 1; | |
var yleap = y - ((18 - m) >> 4); |
/// <summary> | |
/// Crude but effective for my requirements. | |
/// </summary> | |
public class ExpressionMemberInfo<T, TProperty> : MemberInfo | |
{ | |
private static readonly Dictionary<ExpressionType, string> _operatorDescriptions = new Dictionary<ExpressionType, string> | |
{ | |
{ ExpressionType.Add, "+" }, | |
{ ExpressionType.AddAssign, "+" }, | |
{ ExpressionType.AddAssignChecked, "+" }, |
// using DynamicLinq | |
public static Func<TInput, TOutput> GetFuncFromLinq<TInput, TOutput>(this string predicate) | |
{ | |
if (string.IsNullOrWhiteSpace(predicate)) return null; | |
LambdaExpression expression = DynamicExpression.ParseLambda(typeof(TInput), typeof(TOutput), predicate); | |
Func<TInput, TOutput> func = x => (TOutput)expression.Compile().DynamicInvoke(x); | |
return func; |