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 / post-merge
Last active August 29, 2015 13:55
A simple git hook that let's you know whenever you need to update your CocoaPods after merging or pulling from a remote.
#!/bin/bash
#
# Let's you know when your pods should be updated right after a git pull or git merge
# Also works for fast-forward pulls.
#
# To enable this hook for your project, save it as .git/hooks/post-merge
diff "Podfile.lock" "Pods/Manifest.lock" > /dev/null
if [ $? != 0 ] ; then
- (void)bindFormCell:(MYFormCell *)cell toViewModel:(MYFormViewModel *)viewModel withKeyPath:(NSString *)keyPath
{
// signal passing in cell as an observer will complete the signal when cell is dealloced
// (as well as (read "OR") when viewModel is dealloced)
RACSignal *textInputSignal = [viewModel rac_valuesForKeyPath:keyPath observer:cell];
@weakify(cell);
RACDisposable *inputDisposable = [textInputSignal subscribeNext:^(NSString *text) {
@strongify(cell);
cell.textField.text = text;
}];

Keybase proof

I hereby claim:

  • I am stigi on github.
  • I am ullrich (https://keybase.io/ullrich) on keybase.
  • I have a public key whose fingerprint is 9D30 9D84 1E1A 4F29 029F E4D6 AB67 3DC1 F032 8A6A

To claim this, I am signing this object:

//
// main.m
// nil
//
// Created by Ullrich Schäfer on 13.05.14.
// Copyright (c) 2014 nxtbgthng GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
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;
});
});
};
@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)
}
}
//
// RAC.swift
// ReactiveSwift
//
// Created by Yusef Napora on 6/10/14.
// Copyright (c) 2014 Yusef Napora. All rights reserved.
//
import Foundation
@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;

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
* _
_( )_
(_(%)_)
(_)\
| __
HAPPY |/_/
BIRTHDAY |
ORTA |