Skip to content

Instantly share code, notes, and snippets.

View yevhen's full-sized avatar
🇺🇦

Yevhen Bobrov yevhen

🇺🇦
View GitHub Profile
// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2013
// 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,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>[email protected]</email>
@richardkundl
richardkundl / BloomFilter.cs
Created January 7, 2014 14:29
Bloom filter implementation in c#.
namespace BloomFilter
{
using System;
using System.Collections;
/// <summary>
/// Bloom filter.
/// </summary>
/// <typeparam name="T">Item type </typeparam>
public class Filter<T>
@gmamaladze
gmamaladze / A_README.md
Last active August 30, 2024 10:12
HashSet that preserves insertion order or .NET implementation of LinkedHashSet

HashSet that preserves insertion order or .NET implementation of LinkedHashSet

Many people naively assume an ordinary .NET HashSet preserves insertion order. Indeed HashSet accidentally preserves insertion order until you remove and re-add some elements. There is such a data structure in Java - LinkedHashSet which respects order and has O(1) RW times.

No, I did not find a (working) corresponding implementation in .NET. That's I wrote this one.

The implementation uses linked list in combination with dictionary to define the iteration, ordering and at the same time allow O(1) removal.

The order is not affected if an element is re-inserted into the set it retains it's old position.

@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
@simontabor
simontabor / rebalanceRedis.js
Created February 19, 2015 14:53
Redis Cluster slot balancing
var async = require('async');
var Redis = require('redis');
/*
* Rebalance a Redis cluster
*
* 1. Keeps slot allocations in blocks to maintain tidy configuration.
* 2. Moves slots to the coldest node from the hottest node, so the cluster stays healthy whilst rebalancing (`liveBalance`)
*/
@ToJans
ToJans / package.json
Last active August 29, 2015 14:19
Edit-and-continue for client-side web apps with react
{
"name": "SalesDesigner",
"version": "0.0.0",
"description": "Sales designer",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Core bvba",
"license": "",
@ReubenBond
ReubenBond / ClusterManifestTemplate.xml
Last active March 29, 2024 14:27
Speedy Service Fabric Dev Cluster Upgrades
<?xml version="1.0" encoding="utf-8"?>
<!--
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
The settings used within this ClusterManifest are expressly for use only
within a developer single-box environment. Any use of these settings outside
of that environment are highly likely to produce incorrect, and misperforming
  1. Update VS Code settings to treat .csx as .cs

     win: C:\Users\username\AppData\Local\Code\app-0.1.0\resources\app\plugins\vs.language.csharp\ticino.plugin.json
     os x: \AppData\Local\Code\app-0.1.0\resources\app\client\vs\languages\vs.language.csharp\ticino.plugin.json
    

There is an extensions array there tht you should modify.

  1. Get omnisharp-roslyn and build

git clone https://github.com/OmniSharp/omnisharp-roslyn.git

@ThatRendle
ThatRendle / explanation.md
Last active July 3, 2022 07:56
Why I was previously not a fan of Apache Kafka

Update, September 2016

OK, you can pretty much ignore what I wrote below this update, because it doesn't really apply anymore.

I wrote this over a year ago, and at the time I had spent a couple of weeks trying to get Kafka 0.8 working with .NET and then Node.js with much frustration and very little success. I was rather angry. It keeps getting linked, though, and just popped up on Hacker News, so here's sort of an update, although I haven't used Kafka at all this year so I don't really have any new information.

In the end, we managed to get things working with a Node.js client, although we continued to have problems, both with our code and with managing a Kafka/Zookeeper cluster generally. What made it worse was that I did not then, and do not now, believe that Kafka was the correct solution for that particular problem at that particular company. What they were trying to achieve could have been done more simply with any number of other messaging systems, with a subscriber reading messages off and writing

@tugberkugurlu
tugberkugurlu / ComplexTypeConvention.cs
Created April 6, 2016 15:16
Bind complex type objects from body by default on ASP.NET Core 1
using Microsoft.AspNet.Mvc.ApplicationModels;
using Microsoft.AspNet.Mvc.ModelBinding;
using System;
namespace Foo.Web.Infrastructure.Conventions
{
public class ComplexTypeConvention : IActionModelConvention
{
public void Apply(ActionModel action)
{