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
Create the Gist | |
Drag an image into the comment field below. This will upload your image file and insert the markdown code with the url for your uploaded image. | |
Copy this markdown and paste it into the file you want to display it. |
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
#!/bin/sh | |
# grep -R --include "*.bs" 'error\[.*\]' $PROJECT_PATH | cut -d' ' -f9- | sort | uniq | |
geterr4m() { | |
METHOD_NAME="$1" | |
PROJECT_PATH='/c/Nikiforov/dev/nuts-bella/src/Domain/components/'; | |
# echo $METHOD_NAME $PROJECT_PATH | |
METHOD_PATH=$(grep -rl --include "*.bs" "re.*${METHOD_NAME}" $PROJECT_PATH) |
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 SingletonExample; | |
using System.Collections.Generic; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var s1 = Singleton.Instance; | |
var s2 = Singleton.Instance; |
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; | |
namespace Memento { | |
public class Caretaker : Stack<Memento> { } | |
} | |
namespace Memento { | |
public class Memento { | |
public (string Id, int balance) State { get; private set; } | |
//probably better to use read-only state |
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 Interpreter { | |
public abstract class AbstractInterpreter { | |
public abstract int Interpret (Context context); | |
} | |
} | |
namespace Interpreter { | |
public class Context { |
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; | |
namespace ChainOfResponsibility { | |
/// <summary> | |
/// The 'Handler' abstract class | |
/// </summary> | |
public abstract class Approver { | |
public string Id { get; } |
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; | |
namespace ChainOfResponsibility { | |
/// <summary> | |
/// The 'Handler' abstract class | |
/// </summary> | |
public abstract class Approver { | |
public string Id { get; } |
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 State; | |
public class Program { | |
public static void Main () { | |
var ctx = new StateClient (); | |
ctx.State = new StateOne (ctx); | |
Assert.Equal ("StateOne", ctx.State.GetType ().Name); |
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; | |
namespace Command { | |
public class Calculator { | |
private int _curr = 0; | |
public int CurrentResult { get => _curr; set => _curr = value; } | |
public int Operate (char @operator, int operand) { |
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 Visitor; | |
public class Program { | |
public static void Main () { | |
var baseEntry = new SimpleLogEntry () { | |
Created = DateTime.Now, | |
Message = "test" | |
}; |