Skip to content

Instantly share code, notes, and snippets.

@rugheid
rugheid / UpdateListener-swift2.swift
Last active June 24, 2017 16:42
This is an update listener class to automatically update insertDate and updateDate properties for Core Data. This Gist is meant for one of my blog posts: http://www.rugenheidbuchel.be/2015/08/03/core-data-update-listener-in-swift/ Note that there is a Swift 2 and a Swift 3 version!
//
// UpdateListener.swift
// CoreDataUpdateListener
//
// Created by Rugen Heidbuchel on 03/08/15.
// Updated by Rugen Heidbuchel on 03/10/15.
// Copyright © 2015 Rugen Heidbuchel. All rights reserved.
//
import CoreData
@rugheid
rugheid / RHCustomObjectCoder.swift
Last active December 5, 2017 10:13
This is a dictionary coder and JSON serialiser that uses NSCoding. You can use it to convert any object conforming to NSCoding to dictionaries and JSON. I wrote a blog post about how to use this class and how it works here: http://www.rugenheidbuchel.be/2015/10/25/nscoding-to-dictionary-and-json/
//
// RHCustomObjectCoder.swift
//
// Created by Rugen Heidbuchel on 13/10/15.
// Copyright © 2015 Rugen Heidbuchel. All rights reserved.
//
import Foundation

Keybase proof

I hereby claim:

  • I am rugheid on github.
  • I am rugheid (https://keybase.io/rugheid) on keybase.
  • I have a public key whose fingerprint is 719E 3004 3D76 89DC EE33 161F 73E6 C630 BDB1 A312

To claim this, I am signing this object:

def read_format(f):
line = input().split()
tokens = []
for i in range(len(f)):
token, line = f[i](line, i == len(f)-1)
tokens.append(token)
return tokens
def _parse_f(f):
return lambda words, last: (f(words[0]), words[1:])