This file contains hidden or 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
void Main() | |
{ | |
var fileInfoOriginal = new FileInfo(@"C:\Development\project-dev-12345-67890-abcdefg.tar.gz"); // unmodified | |
var fileInfoModified = new FileInfo(@"C:\Development\project-dev-12345-67890-abcdefg-modified.tar.gz"); // modified | |
using var fileStreamOriginal = fileInfoOriginal.OpenRead(); | |
using var decompresssionStreamOriginal = new GZipStream(fileStreamOriginal, CompressionMode.Decompress); | |
var original = InspectTarHeader(decompresssionStreamOriginal); | |
using var fileStreamModified = fileInfoModified.OpenRead(); |
This file contains hidden or 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
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |
FROM mcr.microsoft.com/dotnet/runtime:6.0.0-rc.1-bullseye-slim AS base | |
WORKDIR /app | |
FROM mcr.microsoft.com/dotnet/sdk:6.0.100-rc.1-bullseye-slim AS build | |
WORKDIR /src | |
COPY ["memoryrepro.csproj", ""] | |
RUN dotnet restore "./memoryrepro.csproj" | |
COPY . . |
This file contains hidden or 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
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.402-alpine3.9 AS build | |
ADD . /opt/testapp | |
WORKDIR /opt/testapp | |
RUN dotnet restore && \ | |
dotnet publish -c Release -o dist | |
FROM mcr.microsoft.com/dotnet/core/runtime:2.2.7-alpine3.9 as runtime | |
COPY --from=build /opt/testapp/dist /opt/testapp/dist | |
ENV ASPNETCORE_ENVIRONMENT=Production | |
WORKDIR /opt/testapp/dist |
This file contains hidden or 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 ref struct FastStringBuilder | |
{ | |
private int _pos; | |
private int _totalLength; | |
private readonly ReadOnlyMemory<char>[] _mems; | |
public FastStringBuilder(int maxPieces) | |
{ | |
_pos = 0; | |
_totalLength = 0; |
This file contains hidden or 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.Threading.Tasks; | |
using Amazon; | |
using Amazon.CloudWatchLogs; | |
using Amazon.Extensions.NETCore.Setup; | |
namespace Test | |
{ | |
class Program | |
{ |
This file contains hidden or 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.Threading.Tasks; | |
using SimpleInjector; | |
namespace Your.Namespace | |
{ | |
/// <summary> | |
/// Provides an abstraction for WebJob functions, enabling dependency injection. | |
/// Mandatory to have on all triggered functions for proper disposal of execution scope. | |
/// </summary> |
This file contains hidden or 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 RaygunExceptionHandler | |
{ | |
private static readonly RaygunClient _client; | |
static RaygunExceptionHandler() | |
{ | |
_client = new RaygunClient("your_apikey"); | |
_client.AddWrapperExceptions(typeof(FunctionInvocationException)); | |
} |
This file contains hidden or 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 dbo.fnTableExists('Rewards') = 1 AND dbo.fnColumnExists('Rewards', 'Completed') = 1 | |
Begin | |
PRINT N'Rewards exists and Completed column exists. Removing column.'; | |
ALTER TABLE [dbo].[Rewards] DROP COLUMN [Completed]; | |
PRINT N'Completed column has been removed.'; | |
End |
This file contains hidden or 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
/* | |
Pro: | |
- Least amount of code. | |
- Least amount of mapping. | |
- Least amount of repeated boilerplate code. | |
- Has "AddContents" method. | |
- "GetFriendlyString" functionality is available to ShoppingCartWithContents. | |
Con: | |
- It is not very clear what properties this tree of composed classes contains. To get to the Cart Id you have to dig through cartWithContents.ShoppingCart.Id. |
This file contains hidden or 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 RoomGen | |
{ | |
public class Room | |
{ | |
public Map Map { get; private set; } | |
public Cell OriginCell { get; private set; } |
NewerOlder