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 abstract class StringValueObject<T> where T : StringValueObject<T> | |
{ | |
public string Value { get; protected set; } | |
public static bool operator ==(StringValueObject<T> a, StringValueObject<T> b) | |
{ | |
if (ReferenceEquals(a, b)) | |
{ | |
return true; | |
} |
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 struct Maybe<T> where T : class | |
{ | |
public T Value { get; } | |
public bool HasValue => Value != null; | |
public bool HasNoValue => !HasValue; | |
private Maybe(T value) | |
{ |
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
REM | |
REM if this does not work with a server, rcp server might be blocked with the firewal | |
REM so allow it on a firewall | |
REM | |
REM netsh advfirewall firewall add rule name="Remote IIS inetinfo" dir=in action=allow description="Remote IIS Service Managment" program="%systemroot%\System32\inetsrv\inetinfo.exe" enable=yes | |
REM | |
REM netsh advfirewall firewall add rule name="COM+ Remote Administration (All Programs)" dir=in action=allow description="" program="%windir%\system32\dllhost.exe" enable=yes localport=RPC protocol=tcp | |
iisreset zos-srv2 |
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; | |
namespace Procent.DependencyInjection.app | |
{ | |
public class UsersController | |
{ | |
private readonly IApp _app; | |
public UsersController(IApp application) |
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
f(events) -> state | |
match f(state, event) -> state | |
f(state, command) -> events |
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 static class NSubstituteHelper | |
{ | |
public static void IgnoreAwaitForNSubstituteAssertion(this Task task) | |
{ | |
} | |
} |
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 AutoNSubstituteAttribute : AutoDataAttribute | |
{ | |
public AutoNSubstituteAttribute() | |
: base(()=>new Fixture() | |
.Customize(new AutoPopulatedNSubstitutePropertiesCustomization()) | |
) | |
{ | |
} | |
} |
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 static class Expressions | |
{ | |
static string code = @" | |
public static class __CompiledExpr__ | |
{{ | |
public static {0} Run({1}) | |
{{ | |
return {2}; | |
}} |
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
// version before refactoring | |
using (var key = Registry.CurrentUser.OpenSubKey(RegistryKey, true)) | |
{ | |
var obfuscator = new ViewNameObfuscator("whatever"); | |
key.SetValue("password", obfuscator.Obfuscate(value)); | |
key.Close(); | |
} | |
// version after refactoring - the functionality remained the same - exacly the same | |
return ReadValueFromRegistry(PasswordKeyName, Deobfuscate); |
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
If: | |
- you add and commit with the wrong email address in git, and | |
- your remote has a hook set up to prevent you from pushing with the bad address | |
Then you need to amend the author of your commit before push can succeed: | |
1. fix your email address in git config: | |
$ git config user.name "Your Name" |
NewerOlder