Skip to content

Instantly share code, notes, and snippets.

View NikiforovAll's full-sized avatar
🇺🇦

Oleksii Nikiforov NikiforovAll

🇺🇦
View GitHub Profile
@NikiforovAll
NikiforovAll / Program.cs
Last active June 9, 2019 12:01
StateImpl
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);
@NikiforovAll
NikiforovAll / ChainOfResponsibilityImpl.cs
Created June 9, 2019 13:11
ChainOfResponsibilityImpl
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; }
@NikiforovAll
NikiforovAll / ChainOfResponsibilityImpl.cs
Last active June 9, 2019 13:13
ChainOfResponsibilityImpl
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; }
@NikiforovAll
NikiforovAll / InterpreterImpl.cs
Last active June 9, 2019 13:54
InterpreterImpl
using System;
namespace Interpreter {
public abstract class AbstractInterpreter {
public abstract int Interpret (Context context);
}
}
namespace Interpreter {
public class Context {
@NikiforovAll
NikiforovAll / MementoImpl.cs
Last active June 9, 2019 14:14
MementoImpl
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
using System;
using SingletonExample;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var s1 = Singleton.Instance;
var s2 = Singleton.Instance;
@NikiforovAll
NikiforovAll / get-bella-error-code.sh
Created March 12, 2020 12:33
allows to search for errors in bella hierarchically
#!/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)
@NikiforovAll
NikiforovAll / embed-images-in-markdown
Last active April 15, 2020 08:09
This is POC of hosting images as a gist
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.
@NikiforovAll
NikiforovAll / .gitattributes
Last active April 22, 2020 15:13
Build/Delivery scripts for dotnet
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
@NikiforovAll
NikiforovAll / msbuild-output-error-issues-441
Created May 5, 2020 21:10
msbuild-output-error-tye/issues/441
23:53:31.418 2>Done building target "Restore" in project "Tools.proj".: (TargetId:31)
23:53:31.418 2>Target "InstallDotNetCore: (TargetId:32)" in file "<removed>\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20228.4\tools\InstallDotNetCore.targets" from project "<removed>\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20228.4\tools\Tools.proj" (entry point):
Set Property: _DotNetInstallScript=<removed>\dev\tye\eng\common\dotnet-install.cmd
Task "Exec" skipped, due to false condition; ('$(OS)' != 'Windows_NT') was evaluated as ('Windows_NT' != 'Windows_NT').
Using "InstallDotNetCore" task from assembly "<removed>\.nuget\packages\microsoft.dotnet.arcade.sdk\5.0.0-beta.20228.4\tools\netcoreapp2.1\Microsoft.DotNet.Arcade.Sdk.dll".
Task "InstallDotNetCore" (TaskId:30)
Task Parameter:VersionsPropsPath=<removed>\dev\tye\eng\Versions.props (TaskId:30)
Task Parameter:GlobalJso