Skip to content

Instantly share code, notes, and snippets.

View stigi's full-sized avatar
✌️
Casual coding

Ullrich Schäfer stigi

✌️
Casual coding
View GitHub Profile
@stigi
stigi / gist:75f429d7b5bd659ff347
Created March 11, 2015 22:20
sample Kaleidoscope 1
Analysis of sampling Kaleidoscope (pid 58992) every 1 millisecond
Process: Kaleidoscope [58992]
Path: /Applications/Kaleidoscope.app/Contents/MacOS/Kaleidoscope
Load Address: 0x109dc6000
Identifier: com.blackpixel.kaleidoscope
Version: 2.1.0 (133.01)
Code Type: X86-64
Parent Process: ??? [1]
Date/Time: 2015-03-11 15:20:05.265 -0700
* _
_( )_
(_(%)_)
(_)\
| __
HAPPY |/_/
BIRTHDAY |
ORTA |

Guide for writing Specs

Facts

  • One method = One describe
  • Use -foo for instance methods
  • Use +foo for class methods
  • Use .foo for properties
  • Use <ProtocolName>methodname: for delegate methods
  • Use context inside of describe to describe the behavior for a specific state
@stigi
stigi / 1
Created August 19, 2014 10:41
RACSignal from RACCommand is not subscribed to by `-waitUntilCompleted:`
[[[RACSignal return:@"returnValue"] logAll] waitUntilCompleted:nil];
NSLog(@"Done waiting for return");
RACCommand *c = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id _) {
NSLog(@"Execute command");
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
NSLog(@"Command Signal subscribed");
[subscriber sendNext:@"commandValue"];
[subscriber sendCompleted];
return nil;
//
// RAC.swift
// ReactiveSwift
//
// Created by Yusef Napora on 6/10/14.
// Copyright (c) 2014 Yusef Napora. All rights reserved.
//
import Foundation
@stigi
stigi / CocoaLumberjack.swift
Created August 16, 2014 21:41
A little hack to work comfortably with cocoa lumberjack in Swift.
// Created by Ullrich Schäfer on 16/08/14.
// Bitmasks are a bit tricky in swift
// See http://natecook.com/blog/2014/07/swift-options-bitmask-generator/
//enum LogFlag: Int32 {
// case Error = 0b1
// case Warn = 0b10
// case Info = 0b100
@stigi
stigi / class func.swift
Last active August 29, 2015 14:05
swift compiler bug
import Foundation
println("Hello, World!")
class Test {
class func foo (string:String = "test") {
println("fooz " + string)
}
}
MyCrazyBlock block = ^(BOOL *stop) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// do some work
dispatch_async(dispatch_get_main_queue(), ^{
*stop = YES;
});
});
};
//
// main.m
// nil
//
// Created by Ullrich Schäfer on 13.05.14.
// Copyright (c) 2014 nxtbgthng GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x21e4f30d
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x38f4f626 objc_msgSend + 5
1 UIKit 0x310b2fb1 -[UITableViewRowData(UITableViewRowDataPrivate) _updateNumSections] + 78
2 UIKit 0x310b2ef9 -[UITableViewRowData invalidateAllSections] + 72
3 UIKit 0x310b2c75 -[UITableView _updateRowData] + 208