Skip to content

Instantly share code, notes, and snippets.

View MichalBrylka's full-sized avatar

Michał Bryłka MichalBrylka

View GitHub Profile
using System.Collections.Generic;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using System;
using System.Linq;
using System.Reflection;
using NUnit.Framework.Internal;
namespace NUnit_CountBug
{
@MichalBrylka
MichalBrylka / Library.fs
Last active April 20, 2021 13:19
Cs vs Fs @ branching
namespace Fs
module Bench =
let condition x =
if (x = 1 || x = 2) then 1
elif(x = 3 || x = 4) then 2
else 0
let conditionReorder x =
if (x = 4 || x = 3) then 2
@MichalBrylka
MichalBrylka / Main.cs
Created May 7, 2021 09:25
Play with unsafe string
using System;
using System.Runtime.CompilerServices;
namespace SafeString
{
class Program
{
static void Main(string[] args)
{
var arr = PlaySafe("Hello World!");
using System;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
// ReSharper disable InconsistentNaming
namespace StructBench
{
class Program
{
using System;
using System.Numerics;
using System.Security.Cryptography;
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace ProbablePrimeConstraintDemo
{
[TestFixture]
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using NUnit.Framework;
namespace DynamicCoerce
{
@MichalBrylka
MichalBrylka / Matrix.cs
Created October 20, 2021 20:58
Generic number matrix
using System.Diagnostics.CodeAnalysis;
namespace Net6Demo
{
public interface IParseable<TSelf>
where TSelf : IParseable<TSelf>
{
static abstract TSelf Parse(string s, IFormatProvider? provider);
static abstract bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out TSelf result);
using System;
namespace IntSwap
{
class Program
{
static void Main(string[] args)
{
int i = 1, j = 2;
Swap1(ref i, ref j);
<#
.SYNOPSIS
Create WIP commit message
.EXAMPLE
.\PutCommitDrivenDevelopmentMessage.ps1 "Implement new important feature"
Example output
[feature/New-12345 b0d2215] New-12345 Implement new important feature
#>
@MichalBrylka
MichalBrylka / Main.java
Created December 1, 2021 21:38
Java Guice Ioc
package corp;
import com.google.inject.*;
import java.util.Collections;
public class Main {
public static void main(String[] args) {
Injector injector = Guice.createInjector(new Module());