Skip to content

Instantly share code, notes, and snippets.

Sebastian Rehnby sebreh

  • Copenhagen, Denmark
Block or report user

Report or block sebreh

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
@sebreh
sebreh / RACSupport.swift
Last active Aug 29, 2015
Swift extensions to ReactiveCocoa to make it easier to work with from Swift.
View RACSupport.swift
import Foundation
extension RACSignal {
func subscribeNextAs<T>(nextClosure: (T?) -> Void) {
self.subscribeNext {
(next: AnyObject!) -> () in
let nextAsT = next as? T
nextClosure(nextAsT)
}
View keybase.md

Keybase proof

I hereby claim:

  • I am sebreh on github.
  • I am sebreh (https://keybase.io/sebreh) on keybase.
  • I have a public key whose fingerprint is 2B14 F778 D7BD 6DD3 8189 B22E 7402 37CD 9BDD 32A0

To claim this, I am signing this object:

@sebreh
sebreh / PodioKitExtensions.swift
Created Nov 5, 2014
A set of extensions to PodioKit to make it easier to work with in Swift.
View PodioKitExtensions.swift
extension PKTAsyncTask {
func onSuccess<ResultType>(successBlock: ResultType! -> Void) {
onSuccess { obj in
let typedObj = obj as? ResultType
successBlock(typedObj)
}
}
func onComplete<ResultType>(completeBlock: (ResultType?, NSError?) -> Void) {
@sebreh
sebreh / iOS8ReadinessChecklist.md
Created Jul 25, 2014
iOS 8 Readiness Checklist
View iOS8ReadinessChecklist.md

iOS 8 Readiness Checklist

UIKit

  • Adopt size classes and be aware of the old derecated rotation APIs. Test your app on the resizable simulator.
  • Push Notifications: The API to register for push notifications has changed on iOS 8 with new methods on UIApplication.
  • If you use app icon badges, you need to ask for user permission in order to do so.

Foundation

@sebreh
sebreh / bowling_scores.rb
Last active Aug 9, 2017 — forked from RSpace/bowling_scores.rb
Bowling Kata tests
View bowling_scores.rb
[
[0, [0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0]],
[20, [1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1]],
[6, [1,1, 1,1, 1,1]], # incomplete
[18, [1,1, 6,4, 3]], # incomplete w/ spare
[150, [5,5, 5,5, 5,5, 5,5, 5,5, 5,5, 5,5, 5,5, 5,5, 5,5, 5]],
[47, [1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,1, 10, 10 ,9]],
[173, [7,3, 7,3, 7,3, 7,3, 7,3, 7,3, 7,3, 7,3, 7,3, 7,3, 10]],
[300, [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]],
[280, [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5]], # incomplete
@sebreh
sebreh / NSManagedObjectContext+SRFetchAsync.h
Created May 20, 2013
Category for executing a Core Data fetch request in the background
View NSManagedObjectContext+SRFetchAsync.h
#import <CoreData/CoreData.h>
@interface NSManagedObjectContext (SRFetchAsync)
- (void)sr_executeFetchRequest:(NSFetchRequest *)request completion:(void (^)(NSArray *objects, NSError *error))completion;
@end
@sebreh
sebreh / WeakMacros.h
Last active Dec 11, 2015
Shorthand macros for creating weak references.
View WeakMacros.h
#define SR_WEAK(obj) __typeof__(obj) __weak
#define SR_WEAK_SELF SR_WEAK(self)
// Usage:
// SR_WEAK_SELF weakSelf = self;
@sebreh
sebreh / UIApplication+SRFirstResponder.m
Created Oct 16, 2012
UIApplication category for resigning the current first responder
View UIApplication+SRFirstResponder.m
//
// UIApplication+SRFirstResponder.m
//
// Copyright (C) 2012 Sebastian Rehnby
//
// 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
You can’t perform that action at this time.