Skip to content

Instantly share code, notes, and snippets.

View nanov's full-sized avatar

Dimitar Nanov nanov

View GitHub Profile
@nanov
nanov / StreamCopier.cs
Created May 16, 2024 12:34
C# Stream Copier with replacment - zero allocation NET 8
using System.Buffers;
public ref struct ValueRingBuffer {
public readonly int Length;
private readonly ReadOnlySpan<byte> _firstSegment;
private readonly ReadOnlySpan<byte> _secondSegment;
private readonly bool _hasTwoSegments;
public ValueRingBuffer(ReadOnlySpan<byte> first, ReadOnlySpan<byte> second) {
@nanov
nanov / collection.js
Last active March 23, 2018 07:27
Elasticsearch Denormalizer Example
'use strict';
const { defineCollection } = require('cqrs-eventdenormalizer');
const customerMapping = require('./mappings/customerMapping');
module.exports = defineCollection({
name: 'customer',
context: 'customer',
defaultPayload: 'payload',
repositorySettings: {
{
"swagger": "2.0",
"info": {
"description": "The easiest way to start collecting with eCollect is to integrate with our RESTful API. The API allows you to create and update new customers, submit claims as well as payments, upload and download documents and send and retrieve messages.\n\nTo make our API as explorable as possible, accounts have test mode and live mode API keys. There are no different endpoints for live mode and test mode, just use the appropriate key to perform live or test transactions.\nRequests made with test credentials do not create customers or claims in the Live-environment.\n\n&nbsp;\n\n**API Endpoint:**\n\n`https://api.ecollect.org/v2`\n\n&nbsp;\n\n&nbsp;\n\n### Definitions\n\n**Customer**\n\n**Claim**\n\n**File**\n\n**Payment**\n\n**Refund**\n\n**Message**\n\n**Document**\n\n**Event**\n\n**Account**\n\n**Statement**\n\n## Authentication\n\nBefore transmitting any data to the eCollect API, you will need to authenticate yourself with your secret API key.\n\nWe are working with
@nanov
nanov / apiary.md
Last active September 29, 2017 07:05 — forked from dobromir-bogatev/apiary.md

FORMAT: 1A HOST: https://api.ecollect.org/

eCollect

The easiest way to start collecting with eCollect is to integrate with our RESTful API. The API allows you to create and update new customers, submit claims as well as payments, upload and download documents and send and retrieve messages.

To make our API as explorable as possible, accounts have test mode and live mode API keys. There are no different endpoints for live mode and test mode, just use the appropriate key to perform live or test transactions. Requests made with test credentials do not create customers or claims in the Live-environment.

@nanov
nanov / MomentJsFormatConverter-Nanov.cs
Last active August 26, 2016 13:09 — forked from spooky/MomentJsFormatConverter.cs
moment.js to .net format converter
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Web.Components.BootstrapTagHelpers.Support
{
public static class MomentJsFormatConverter
{
private static readonly Dictionary<string,string> _tokenDifferenceLookup;