Skip to content

Instantly share code, notes, and snippets.

View amilos's full-sized avatar

Aleksandar Milosevic amilos

View GitHub Profile
@amilos
amilos / FriendlyId.cs
Last active March 10, 2016 19:22
Friendly ID generator that creates 10-character string identifiers
using System;
using System.Linq;
using System.Text;
namespace Asseco.MiscUtils
{
/*
* Based on Firebase ids but modified for shorter ids and base62 alphabet
*/
@amilos
amilos / dark-plus.css
Created July 18, 2016 17:59
Dark+ (Visual Studio) theme for JSONView Chrome extension
body {
background-color: rgba(30,30,30,1);
color: rgba(212,212,212,1);
font-size: 14px;
white-space: pre !important;
font-family: "Roboto Mono", "Source Code Pro", Menlo, "Ubuntu Mono", Monaco, Consolas, Courier, monospace;
padding: 30px 30px 20px;
}
.property {
@amilos
amilos / gist:88cc4ba07868356495dc0608d2f6a552
Created August 17, 2016 06:25 — forked from tjrobinson/gist:0ad6c790e90d7a385eb1
ActiveDirectoryUserService.cs
using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core;
using Thinktecture.IdentityServer.Core.Models;
using Thinktecture.IdentityServer.Core.Services;
@amilos
amilos / PeriodSerialization.cs
Created August 18, 2016 14:31
Using NodaTime Period class to serialize/deserialize ISO 8601 duration
using System;
using System.Text;
using System.IO;
using Newtonsoft.Json;
using NodaTime;
using NodaTime.Serialization.JsonNet;
namespace FormattingUtils
{
@amilos
amilos / EventRecord.cs
Last active May 29, 2017 18:29
Example of model setup for JSON serialization with extension data
namespace Asseco.Rest.Models
{
[DataContract]
public partial class EventRecord
{
[JsonExtensionData]
internal Dictionary<string, object> udf;
public EventRecord(string EventKind = default(string))
{
@amilos
amilos / KebabCaseResolver.cs
Last active October 9, 2017 16:50
Kebab case resolver extension for Newtonsoft.JSON library
using Newtonsoft.Json.Serialization;
namespace Asseco.JsonUtils
{
public class KebabCaseResolver : DefaultContractResolver
{
private Regex regex = new Regex("(?<!^)((?<=[a-zA-Z0-9])[A-Z][a-z])|((?<=[a-z])[A-Z])", RegexOptions.Compiled);
protected override string ResolvePropertyName(string propertyName)
{
@amilos
amilos / KebabCaseNamingStrategy.cs
Created October 9, 2017 16:56
Kebab case naming strategy extension for Newtonsoft.JSON library
using System.Text;
using Newtonsoft.Json.Serialization;
namespace Asseco.JsonUtils
{
// Adapted from SnakeCaseNamingStrategy from Newtonsoft.Json library
public class KebabCaseNamingStrategy : NamingStrategy
{
const char HYPHEN = '-';
const char UNDERSCORE = '_';
@amilos
amilos / FolderController.cs
Created October 20, 2017 17:00
Use of wildcard and regex based route constraints in asp.net
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using System.IO;
namespace Asseco.Content.Controllers
{
[Route("api/v1/content/")]
public class FolderController : Controller
{
private JsonResult GetFileByPath(string repo, string folder, string file)
@amilos
amilos / xs2a-oas2.yaml
Last active December 15, 2017 14:03
PSD2 XS2A API in OAS2 format
swagger: '2.0'
info:
version: '1.0.0'
title: PSD2 XS2A API
description: Uniform, interoperable and PSD2 compliant Access to Account interface
license:
name: MIT
url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
contact:
name: Aleksandar Milosevic
@amilos
amilos / bg-psd2.yaml
Last active May 24, 2024 08:01
Berlin Group PSD2 API specified in Openapi v3 format
openapi: 3.0.1
info:
title: BG PSD2 API
version: "1.2"
description: |
# Summary
The **NextGenPSD2** *Framework Version 1.2* offers a modern, open, harmonised and interoperable set of
Application Programming Interfaces (APIs) as the safest and most efficient way to provide data securely.
The NextGenPSD2 Framework reduces XS2A complexity and costs, addresses the problem of multiple competing standards
in Europe and, aligned with the goals of the Euro Retail Payments Board,