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
kristopherjohnson / DataStore.swift
Created Sep 28, 2014
Swift: Core Data persistence stack
View DataStore.swift
import Foundation
import CoreData
// "Class variables" used in DataStore.sharedDataStore()
private var _instance: DataStore?
private var DataStoreClassLock = NSRecursiveLock()
private let appStoreFilename = "DataStore.sqlite"
private let testStoreFilename = "test_DataStore.sqlite"
jstn / RandomNumbers.swift
Last active Oct 2, 2018
generate random numbers for 64-bit types while mitigating modulo bias
View RandomNumbers.swift
`arc4random_uniform` is very useful but limited to `UInt32`.
This defines a generic version of `arc4random` for any type
expressible by an integer literal, and extends some numeric
types with a `random` method that mitigates for modulo bias
in the same manner as `arc4random`.
`lower` is inclusive and `upper` is exclusive, thus:
View solarized-dark.css
/* Solarized Dark
For use with Jekyll and Pygments
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
DivineDominion / markdownTemplate.txt
Last active Sep 10, 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?>
luisobo /
Last active Jan 14, 2016
Hide iOS Simulator when running Unit Tests.

Hide iOS Simulator when running Unit Tests.

Based on this work, that @Dan2552 pointed out.


  1. Clone this gist (git clone hide_ios_simulator)
  2. Xcode -> Preferences -> Behavior -> Testing -> Generates output
  3. Run script -> Choose script -> Select hide_simulator
steipete / PSPDFThreadSafeMutableDictionary.m
Last active Oct 17, 2019
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
View PSPDFThreadSafeMutableDictionary.m
// PSPDFThreadSafeMutableDictionary.m
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
View date.m
#include <time.h>
+ (NSDate *)dateFromISO8601String:(NSString *)string {
if (!string) {
return nil;
struct tm tm;
time_t t;
View lilwiki.rb
require 'rubygems'
require 'sinatra'
require 'rdiscount'
require 'haml'
require 'dm-core'
require 'sinatra-authentication'
use Rack::Session::Cookie, 'shhhhhhhhhhhhhhh~'
class Page
You can’t perform that action at this time.