Skip to content

Instantly share code, notes, and snippets.

Christian Tietze DivineDominion

Block or report user

Report or block DivineDominion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Subscription.swift
import Foundation
public struct Subscription<State: Any> {
let subscriber: AnyStoreSubscriber
let selector: (State -> Any)
init(aSubscriber: AnyStoreSubscriber) {
DivineDominion / 01 client.swift
Created Oct 3, 2015
Chaining async event handling
View 01 client.swift
import Foundation
// Application Service, responsible for transactions
class CreateGroupedMonitor {
// Domain Services:
let monitoringService: MonitorFile
let monitorMovalService: MoveMonitor
init(monitoringService: MonitorFile, groupCreationService: CreateGroup, monitorMovalService: MoveMonitor, updateSchedule: UpdateSchedule, wordCountStrategyRegistry: WordCountStrategyRegistry, monitorRepository: MonitorRepository) {
View chaining-bind.swift
import Cocoa
// MARK: Part of Your New Toolkit
func bind<T, U>(optional: T?, f: T -> U?) -> U? {
if let x = optional {
return f(x)
else {
DivineDominion / DomainEvent.swift
Last active Aug 29, 2015
Domain Events v1.1 -- without event name enum
View DomainEvent.swift
import Foundation
public typealias UserInfo = [NSObject : AnyObject]
public protocol DomainEvent {
class var eventName: String { get }
init(userInfo: UserInfo)
func userInfo() -> UserInfo
DivineDominion / ValueTransformation.swift
Created Mar 1, 2015
Paste this into a playground and see what happens with the two client code examples at the bottom. Should work out of the box.
View ValueTransformation.swift
import Cocoa
/// A wrapper around any type to make Result compile
class Box<T> {
let unbox: T
init(_ value: T) {
self.unbox = value
DivineDominion / TestCase.swift
Last active Aug 15, 2018 — forked from akolov/TestCase.swift
Bridging XCTAssertThrows to Swift to catch exceptions. (Doesn't work with assert(), though)
View TestCase.swift
class ExceptionTestCase: XCTestCase {
func raisesException() {
var exception = NSException(name: NSInternalInconsistencyException, reason: "Testing exceptions", userInfo: nil)
XCTAssertThrows({ exception.raise() })
XCTAssertThrowsSpecific({ exception.raise() }, NSInternalInconsistencyException, "Should raise NSInternalInconsistencyException")
View contact_spec.rb
feature 'Contact form POST without Ajax', :js => false do
context 'without name' do
it 'shows the index' do
within('#request-form') do
fill_in 'request-email', :with => ''
fill_in 'request-anliegen', :with => 'Test'
fill_in 'request-seiten', :with => '123'
click_button 'Anfragen'
DivineDominion / nvALT Zettel Headel.scpt
Created Sep 11, 2014
AppleScript to rename notes in nvALT with the Zettel ID and a title of your choosing. Also inserts the information as a header into the note.
View nvALT Zettel Headel.scpt
-- Extend "current date"
script FormattedDate
property parent : current date
on twoDigitDisplay(aNumber)
set multiplier to 10 ^ 2 #howManyDigits
return "" & (text 2 thru 3 of ((multiplier + aNumber) as string))
end twoDigitDisplay
end script
DivineDominion /
Last active Dec 13, 2016
nvALT Preview Template featuring relative paths

Run this from your terminal to execute the setup script. It creates the directory and downloads the template right into this new folder.

curl -s | bash 

Aferwards, you can change the base directory in ~/Library/Application\ Support/nvALT/template.html as expected.

DivineDominion / markdownTemplate.txt
Last active Jan 13, 2019
BibDesk MultiMarkdown export template. Put into `~/Library/Application Support/BibDesk/Templates` and activate in settings to use.--- From
View markdownTemplate.txt
[#<$citeKey/>]: <$>
<$><?$><$> (Hrsg.)
<$fields.Year?> (<$fields.Year/>)</$fields.Year?>: _<$fields.Title.stringByRemovingTeX/><$fields.Subtitle?>. <$fields.Subtitle.stringByRemovingTeX/></$fields.Subtitle?>_<$pubType=article?>
, <$fields.Journal/><$fields.Number?> <$fields.Number/></$fields.Number?>, <$fields.Year/>, Vol. <$fields.Volume/>, S. <$fields.Pages/><?$pubType=incollection?>
, in: <$fields.Booktitle/><$fields.Address?>, <$fields.Address/>: <$fields.Publisher?><$fields.Publisher/></$fields.Publisher?><?$fields.Address?>
<$fields.Publisher?>, <$fields.Publisher/></$fields.Publisher?>
You can’t perform that action at this time.