Skip to content

Instantly share code, notes, and snippets.

@stijnmoreels
stijnmoreels / TaskExtensions.cs
Last active February 14, 2018 12:20
Task Extensions with Monad Laws
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Threading.Tasks
{
public class Workspace
{
@clemensv
clemensv / sbfifo.md
Last active November 20, 2017 07:16

FIFO in Service Bus

The explantion below is taken out of the context of an internal email exchange, and while we already have product documentation about this topic, this also seemed worth sharing. The email context stated that the customer asked for string First-In-First-Out (FIFO) assurances, but without any specifics about their scenario. Scenarios for hard FIFO requirements are not very common, I might add:

"It’s usually helpful to ask the customer back on exactly why they want they want true in-order delivery, i.e. FIFO, and then look at the use-case.

Service Bus has a specific feature for helping with order assurances, namely Sessions.

Order preservation requires a grouping criterion for the sequence you need ordered, and it needs a mechanism that ensures that messages are delivered to a receiver in that order. That includes not only that the sequence sorting is observed, but that also that no messages go missing b

@vStone
vStone / telemeter.sh
Created September 14, 2017 16:53
Telenet Telemeter Script
#!/bin/bash
# requirements:
# - curl
# - nokogiri
# usage: fill in username and password here, execute, and it spits out json array with your usage
username=<< Fill your username in here >>
password=<< Fill your password in here >>

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@NickCraver
NickCraver / DmpAnalysis.linq
Last active May 1, 2024 21:09
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@paragonie-scott
paragonie-scott / crypto-wrong-answers.md
Last active April 21, 2024 23:48
An Open Letter to Developers Everywhere (About Cryptography)
@DanDiplo
DanDiplo / JS-LINQ.js
Last active June 25, 2024 23:39
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@bennor
bennor / ProxyRestService.cs
Last active October 24, 2023 15:31
A polyfill for Refit 2.0+ in scripting environments (e.g. LINQPad). Warning: This won't work on all platforms Refit 2.0+ supports (e.g. iOS, maybe WinRT?).
using System.Net.Http;
using Castle.DynamicProxy; // From Castle.Core
using Refit;
public class ProxyRestService
{
static readonly ProxyGenerator Generator = new ProxyGenerator();
public static T For<T>(HttpClient client)
where T : class
@davidfowl
davidfowl / dotnetlayout.md
Last active July 4, 2024 01:57
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/