Skip to content

Instantly share code, notes, and snippets.

View stefc's full-sized avatar

Stefan B\u+00F6ther stefc

View GitHub Profile
@stefc
stefc / BitArray.swift
Last active January 10, 2023 11:55
BitArray based on CFBitVector Swift implementation
//
// BitArray.swift
// xFuncs
//
import Foundation
public class BitArray : CollectionType {
public typealias Index = Int
@stefc
stefc / ServiceLocator.swift
Last active March 17, 2016 21:29
ligthweight IoC Container & ServiceLocator in Swift
//
// ServiceLocator.swift
//
// Created by Stefan Böther on 12.03.16.
//
// Inspired by the following =>
// https://github.com/DivineDominion/mac-appdev-code/blob/master/DDDViewDataExample/ServiceLocator.swift
// https://gist.github.com/werediver/66ff8f13c900e9871070
// https://github.com/Swinject/Swinject
@stefc
stefc / IdSequence.swift
Created March 12, 2016 19:54
sequence for generate int32 identifiers in Swift
//
// IdGenerator.swift
// Created by Stefan Böther on 21.12.15.
//
import Foundation
class IdSequence : SequenceType {
func generate() -> AnyGenerator<Int32> {
var value : Int32 = 0
@stefc
stefc / Bundesland.R
Created April 26, 2016 09:50
Bundesländer Geo-Chart
library(googleVis)
# Bundesländer
countries <- factor(c(
"Schleswig-Holstein","Hamburg","Niedersachsen","Bremen",
"Nordrhein-Westfalen","Hessen","Rheinland-Pfalz",
"Baden-Württemberg","Bayern","Saarland","Berlin","Brandenburg",
"Mecklenburg-Vorpommern","Sachsen","Sachsen-Anhalt",
"Thüringen"))
@stefc
stefc / Fib1.cs
Created June 21, 2016 12:29
Functional Fibonacci
public static ulong fib1(int n)
{
ulong a = 0;
ulong b = 1;
for (int i = 0; i < n; i++)
{
ulong temp = a;
a = b;
b = temp + b;
}
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
BindIPv6Only=both
Service=docker.service
[Install]
WantedBy=sockets.target
@stefc
stefc / Commands.cs
Created August 6, 2016 12:26
NancyFX ModelBinding Example
public class AufnehmenAufgabe : IDomainCommand {
public Guid Id { get; }
public string Titel { get; }
public AufnehmenAufgabe(Guid id, string titel)
{
Id = id;
Titel = titel;
}
}
@stefc
stefc / Bootstrapper.cs
Created August 8, 2016 15:09
Bootstrapper for NancyFx combined with a FeatureToggle (FeatureSwitcher)
using System.Collections.Generic;
using System.Linq;
using Nancy;
using Nancy.Bootstrapper;
using FeatureSwitcher;
using txs.nextgen.apigateway.todo;
namespace txs.nextgen.apigateway
{
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1f8FlqHY9rraoXNiw56ESSl2WYM68j5sMruqLQe47Km1GOwCM3yeWUNKx+CKoDGHSyU4wxd9Dzs+JaCrhVdCF8rE5sqDxmK6d2fCIAHShlTs5vEfHqGbnKEipFptgMHvKE8+EHjR32bFzyjkOHzIiOtfs+9H69/OfvbLr3AcNvxAgtV8AM9hzXH8N7Qo5A6ZfI9UBtoFSTzUnKikh4Mw92+XDRDwraWMiEc/8TvVnfK7BX9d4NaKWfRwSh3qBCbh0wZhWBWRNdsX+YYrmmkyd6eVnkhEpnhbbNVbHw0xBScStqM/VuU4NVF6UJaZt9DRcq+UCwJz76KS2LTY75wjt jona.johannes.nitsch@txs.de
@stefc
stefc / DataVaultTokenizer.cs
Created August 11, 2017 06:57
DataVaultTokenizer
using System.Collections.Generic;
using Superpower.Model;
using Superpower.Parsers;
using Superpower;
using System;
namespace datavault.dsl {
class DataVaultTokenizer : Tokenizer<DataVaultToken> {