Skip to content

Instantly share code, notes, and snippets.

@ms-lemos
ms-lemos / MoqToFakeItEasy.DotSettings
Last active September 13, 2023 09:58 — forked from danielmarbach/MoqToFakeItEasy.DotSettings
Structural Search and Replace Pattern for Migration from Moq to FakeItEasy with Resharper
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=02D37A8117D341449F014A1951575BAD/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=02D37A8117D341449F014A1951575BAD/Comment/@EntryValue">Moq Verify with Method to A.CallTo with MustHaveHappened Once Nested</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=02D37A8117D341449F014A1951575BAD/CustomPatternPlaceholder/=fieldName/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=02D37A8117D341449F014A1951575BAD/CustomPatternPlaceholder/=fieldName/Properties/=CaseSensitive/@EntryIndexedValue">True</s:String>
<s:String
@akhansari
akhansari / onion-1.fs
Last active February 22, 2023 16:51
F# : Onion architecture in a nutshell
// 1. pure, don't think about IO at all
module Domain =
let add x y = x + y
// 2. think about IO but not its implementation
module App =
let add (getX: unit -> Async<int32>) y =
async {
let! x = getX ()
return Domain.add x y
@madd0
madd0 / kusto-null-bins
Created April 21, 2020 13:45
Add "empty" bins to a kusto query
let Start=startofday(ago(2d));
let Stop=startofday(ago(1d));
requests
| where timestamp >= Start and timestamp < Stop
| summarize Count=count() by bin(timestamp, 1h)
| union (
range x from 1 to 1 step 1
| mv-expand timestamp=range(Start, Stop, 1h) to typeof(datetime)
| extend Count = 0
)
@mbohun
mbohun / NOTES.md
Last active April 2, 2024 14:08
Converting MS Office files to PDF

Converting MS Office files to PDF

(Description of the different solutions / alternatives)

1. Microsoft Windows based solutions

1.1 Microsoft Graph API (Office 365)

This is the current, official, Microsoft endorsed/supported solution ("cloud based")
(2017 - present)

  1. The user uploads their MS Office document (source.doc in our example snippet bellow) to their Microsoft OneDrive
  2. The user then uses the Microsoft Graph REST API to send a HTTP GET Request to the Convert content endpoint:
@bravo-kernel
bravo-kernel / azure-pipelines.yml
Last active April 26, 2024 12:35
Multi-stage Azure Devops Pipeline with cross-platform matrix
# Determines which branch(es) will cause a CI build to be started
trigger:
- master
# Stages precede strategy, in other words each stage can contain a strategy (or multiple or none)
# Full run-cylce described here: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/runs?view=azure-devops
stages:
- stage: Prepare
jobs:
- job:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
// A separate NuGet package.
namespace Acme.Validation
{
public static class Validator
{
@juanarbol
juanarbol / chmodCheatSheet.md
Last active April 10, 2024 19:17
Chmod cheat sheet

Chmod codes cheat sheet

How to use chmod codes in UNIX:

  1. There are three types of permissions in files and folders in unix
    1. Read (r)
    2. Write (w)
    3. Execute (x)
  2. And, there is a classification of users called UGO (explained bellow):
  3. U ~> User (usually, you)
@pellared
pellared / AddressObjectMother.cs
Last active April 20, 2020 18:27
Parameterized Object Mother in C# as an alternative to Test Data Builder pattern (thanks to named arguments with default values)
public static class AddressObjectMother
{
public static Address Create(string street = "", string city = "", PostCode postCode = null)
{
if (postCode == null)
{
postCode = PostCodeObjectMother.Create();
}
return new Address(street, city, postCode);
@tmakin
tmakin / ExportPdf.cs
Last active December 17, 2022 11:29
Create PDF Rendering service in Azure Functions
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using DinkToPdf;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using IPdfConverter = DinkToPdf.Contracts.IConverter;
@jmarolf
jmarolf / editorconfig.md
Last active September 26, 2023 12:55
List of all options and how they may be implemented in editorconfig

Advanced

editorconfig name possible values
dotnet_sort_system_directives_first true , false

Indentation Options

editorconfig name possible values
csharp_indent_block_contents true , false
csharp_indent_braces true , false