Skip to content

Instantly share code, notes, and snippets.

View m-jovanovic's full-sized avatar
🚀
Shipping code every day!

Milan Jovanović m-jovanovic

🚀
Shipping code every day!
View GitHub Profile
@m-jovanovic
m-jovanovic / publish.yml
Created January 10, 2025 17:14
Sample GitHub Actions workflow to build a .NET application, build a Docker image, upload to Azure Container Registry, and then publish the image into Azure Container App
name: Deploy to Azure Container Apps
on:
workflow_dispatch:
push:
branches: [main]
env:
AZURE_CONTAINER_REGISTRY: <NAME>
CONTAINER_APP_NAME: <NAME>
@m-jovanovic
m-jovanovic / Directory.Build.props
Created December 5, 2024 21:14
Example Directory.Build.props you can add in a Visual Studio solution to implement Central Package Management.
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Polly" Version="8.5.0" />
</ItemGroup>
</Project>
import config from "./config.js";
document.addEventListener("DOMContentLoaded", () => {
const fileInputMultipart = document.getElementById("fileInputMultipart");
const uploadButtonMultipart = document.getElementById(
"uploadButtonMultipart"
);
const pauseResumeButton = document.getElementById("pauseResumeButton");
const uploadProgressMultipart = document.getElementById(
"uploadProgressMultipart"
using BenchmarkDotNet.Attributes;
namespace BinarySearch.Benchmark;
[MemoryDiagnoser]
public class SearchBenchmark
{
private static readonly int[] Numbers = Enumerable.Range(1, 1_000_000).ToArray();
[Params(333_333, 777_777)]
@m-jovanovic
m-jovanovic / Result.cs
Created September 7, 2023 08:03
Result type
public class Result
{
protected internal Result(bool isSuccess, Error error)
{
if (isSuccess && error != Error.None)
{
throw new InvalidOperationException();
}
if (!isSuccess && error == Error.None)
@m-jovanovic
m-jovanovic / .editorconfig
Created June 7, 2023 12:17
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
@m-jovanovic
m-jovanovic / .editorconfig
Created May 16, 2023 10:50
A sample Editorconfig file for Visual Studio
[*.cs]
# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none
# IDE0053: Use expression body for lambda expressions
dotnet_diagnostic.IDE0053.severity = none
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:error
csharp_prefer_simple_using_statement = true:error
name: Publish Development 🚀
on:
workflow_dispatch:
push:
branches:
- main
env:
AZURE_WEBAPP_NAME: dev-api-trainersphere