Skip to content

Instantly share code, notes, and snippets.

Dirk Holtwick holtwick

Block or report user

Report or block holtwick

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
@holtwick
holtwick / HORegExp.h
Last active Sep 10, 2018
ObjC RegExp Helper with rudimentary named groups
View HORegExp.h
// Copyright 2012 Dirk Holtwick, holtwick.it. All rights reserved.
@import Foundation;
#define HORegexDefaultOptions NSRegularExpressionCaseInsensitive | NSRegularExpressionAnchorsMatchLines | NSRegularExpressionAllowCommentsAndWhitespace
@interface HORegexMatch : NSTextCheckingResult
@property (readonly, nonatomic) NSString *text;
@property (readonly, nonatomic) NSTextCheckingResult *match;
@holtwick
holtwick / KeyPathHelper.m
Last active Jun 21, 2018
Autocomplete and refactoring compatible keyPaths: https://holtwick.de/blog/keypath-refatoring
View KeyPathHelper.m
// (C)opyright 2018-06-20 Dirk Holtwick, holtwick.it. All rights reserved.
#import <Foundation/Foundation.h>
#define keyPath(k) YES ? @#k : (k ? @"": nil)
#define keyPathFromObject(o, k) YES ? @#k : ((o ?: o.k) ? @"" : nil)
@interface Sample : NSObject
@property id greeting;
@end
View SeaObject.h
// (C)opyright 2018-04-25 Dirk Holtwick, holtwick.it. All rights reserved.
#import <Foundation/Foundation.h>
/* A dictionary like object that allows to define custom dynamic properties
* for typed and easy access. Only simple types like string, number, array and
* dictionary are supported. It is mainly thought to be a convenience class that
* can be serialized easily to JSON and other formats.
*
* MAKE SURE to add @dynamic for any property you define in a subclass of SeaObject!
@holtwick
holtwick / SeaDataSpeedTests.m
Created Feb 3, 2018
Speed and size testing for JSON, MessagePack, Plist and KeyedArchiver
View SeaDataSpeedTests.m
// (C)opyright 2018-02-03 Dirk Holtwick, holtwick.it. All rights reserved.
#import <XCTest/XCTest.h>
#import "MPMessagePack.h"
#import "NSData+GZIP.h"
@interface SeaDataSpeedTests : XCTestCase
@end
@holtwick
holtwick / proceedsappstore.py
Created Dec 7, 2010
Analyze AppStore Daily Reports
View proceedsappstore.py
import glob
d = {}
for fn in glob.glob('appsales/*.txt'):
lines = open(fn, 'r').readlines()[1:]
# print fn
for l in lines:
l = l.split('\t')
if len(l) == 18: # only newest format
proceeds = float(l[8])
View macro.m
#if DEBUG
#import <objc/runtime.h>
#import <objc/message.h>
#include <execinfo.h>
#include <stdio.h>
void dumpCall(id *__selfPtr, SEL __cmd) {
// Get argument stack
id __self = *__selfPtr;
@holtwick
holtwick / asmacro.m
Created Oct 29, 2010
Log current method and the arguments passed to that method
View asmacro.m
#if DEBUG
#import <objc/runtime.h>
#import <objc/message.h>
#include <execinfo.h>
#include <stdio.h>
void dumpCall(id *__selfPtr, SEL __cmd) {
// Get argument stack
id __self = *__selfPtr;
View NSLog printing method name together with passed arguments.m
- (void)test:(id)some second:(id)sec {
// Inspired by http://stackoverflow.com/questions/1797964/how-to-pass-all-arguments-of-a-method-into-nslog/1799472#1799472
{
// Find argument stack and skip first arguments
void *stack = &self;
stack += sizeof(self);
stack += sizeof(_cmd);
View imapbackup.py
#!/usr/bin/env python2.6
"""IMAP Incremental Backup Script"""
__version__ = "1.4a"
__author__ = "Rui Carmo (http://the.taoofmac.com)"
__copyright__ = "(C) 2006 Rui Carmo. Code under BSD License.\n(C)"
__contributors__ = "Bob Ippolito, Michael Leonhard, Giuseppe Scrivano <gscrivano@gnu.org>"
# = Contributors =
# Giuseppe Scrivano: Added support for folders.
View waveboard-robot.py
# -*- coding: UTF-8 -*-
# Copyright 2009 Dirk Holtwick
# http://www.holtwick.it
VERSION = '1'
import logging
from waveapi import events
You can’t perform that action at this time.