Skip to content

Instantly share code, notes, and snippets.

View andyarvanitis's full-sized avatar

Andy Arvanitis andyarvanitis

View GitHub Profile
@andyarvanitis
andyarvanitis / tiny_reactive_before_after.txt
Last active December 18, 2015 09:29
Another little eero ReactiveCocoa example. This one is from one of the official examples from GitHub.
// Only log names that start with "j".
// Objective-C version...
[[RACAble(self.username)
filter:^(NSString *newName) {
return [newName hasPrefix:@"j"];
}]
subscribeNext:^(NSString *newName) {
NSLog(@"%@", newName);
@andyarvanitis
andyarvanitis / tiny_reactive.eero
Last active December 18, 2015 09:19
Trivial example of using ReactiveCocoa with Eero.
#import <Foundation/Foundation.h>
#import <ReactiveCocoa/ReactiveCocoa.h>
interface Reactive
property (retain)
String name
String address
registerProperties
@andyarvanitis
andyarvanitis / only_dots.eero
Last active December 18, 2015 02:18
A snippet of code showing "global dot-notation" for Eero message sending (currently under evaluation).
parseQueue = OperationQueue.new
NotificationCenter.defaultCenter.addObserver: self,
selector: |addEarthquakes:|,
name: kAddEarthquakesNotif,
object: nil
...
self.parseQueue.addOperation: parseOperation
parseOperation.release // once added to the NSOperationQueue it's retained, we don't need it anymore
@andyarvanitis
andyarvanitis / typed_collections.eero
Created January 15, 2013 07:07
Eero supports (as an experimental feature) 'instancetype' for method parameter types. Inspired by Jonathan Sterling's blog: http://www.jonmsterling.com/posts/2012-02-05-typed-collections-with-self-types-in-objective-c.html
protocol OrderedCollection <FastEnumeration>
at: UInteger index, return instancetype
put: instancetype object
end
protocol MapCollection <FastEnumeration>
at: id key, return instancetype