Skip to content

Instantly share code, notes, and snippets.

View georgiosd's full-sized avatar

Georgios Diamantopoulos georgiosd

View GitHub Profile
'use strict';
* A module for adding new a routing system Angular 1.
angular.module('ngComponentRouter', [])
.directive('ngOutlet', ngOutletDirective)
.directive('ngOutlet', ngOutletFillContentDirective)
.directive('ngLink', ngLinkDirective);
georgiosd / PorterAnalyzer.cs
Created October 13, 2013 11:22
Porter stemming analyzer for RavenDB
public class PorterAnalyzer : Analyzer
/// <summary>An unmodifiable set containing some common English words that are usually not
/// useful for searching.
/// </summary>
public static readonly ISet<string> StopWordsSet = StopAnalyzer.ENGLISH_STOP_WORDS_SET;
/// <summary>Default maximum allowed token length </summary>
public const int DefaultMaxTokenLength = 255;
georgiosd / BlockingCollectionExtensions.cs
Last active October 31, 2018 22:09
Throttle items consumed from a BlockingCollection<T>
// Copyright (c) Georgios Diamantopoulos. All rights reserved.
// Licensed under the MIT license. See LICENSE in this gist for full license information.
// The Throttle class is the RateGate class published here, renamed and copied for convenience.
public static class BlockingCollectionExtensions
// TODO: devise a way to avoid problems if collection gets too big (produced faster than consumed)
public static IObservable<T> AsRateLimitedObservable<T>(this BlockingCollection<T> sequence, int items, TimeSpan timePeriod, CancellationToken producerToken)
Subject<T> subject = new Subject<T>();
georgiosd / DataProtectionBuilderExtensions.cs
Created November 14, 2023 13:38
RavenDB ASP.NET Data Protection Repository
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Microsoft.AspNetCore.DataProtection.Repositories;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;