Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephan zpqrtbnk

View GitHub Profile
View HazelcastIssue466.cs
// Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
View NullCoalesceBenchmark
// executed with:
// var config = DefaultConfig.Instance
.WithArtifactsPath(artPath)
.AddDiagnoser(MemoryDiagnoser.Default)
.AddJob(Job.InProcess);
// BenchmarkRunner.Run(typeof(NullCoalesce), config);
public class NullCoalesce
{
private bool _toggle;
@zpqrtbnk
zpqrtbnk / NamedServiceExtensions.cs
Last active Jan 11, 2019
Named Services for MS.DI
View NamedServiceExtensions.cs
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
namespace MSDI
{
public static class NamedServiceExtensions
@zpqrtbnk
zpqrtbnk / ValueTuple3Benchmark.cs
Last active May 31, 2020
ValueTuple Benchmark
View ValueTuple3Benchmark.cs
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Validators;
// here are the results I get:
@zpqrtbnk
zpqrtbnk / Test.cs
Last active Aug 29, 2015
Recurse Vs Stack Benchmark
View Test.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRunner
{
@zpqrtbnk
zpqrtbnk / markdown.md
Last active Mar 20, 2018
Markdown Sandbox
View markdown.md

Umbraco Version 8 Technical Notes

Welcome


@zpqrtbnk
zpqrtbnk / ContentSet.cshtml
Last active Dec 23, 2015
Demo usage of ToContentSet()
View ContentSet.cshtml
// IPublishedContent implements IsFirst, IsOdd, Index and various stuff
// so technically it's possible to do
@foreach(var content in contents)
{
<div class="@(content.IsFirst() ? "first" : "") @(content.IsOdd() ? "odd" : "even")" id="item-@(content.Index())">
@content.Name
</div>
}
// however, because of some issues in IPublishedContent, IsFirst, IsOdd, Index... all
@zpqrtbnk
zpqrtbnk / Article.cs
Last active Dec 22, 2015
Umbraco strongly typed published content experiments
View Article.cs
// demo of a basic strongly typed published content for an article
// you just need to drop the following class anywhere in your code
// and every strongly typed methods returning IPublishedContent will
// actually return an Article instance (which is an IPublishedContent)
// we want the class named Article though the content type alias is 'newsArticle'
[PublishedContentModel("newsArticle")]
public partial class Article : PublishedContentModel
{
public Article(IPublishedContent content)