#import <Objection/Objection.h> | |
#import <ReactiveCocoa/ReactiveCocoa.h> | |
#import <ReactiveCocoa/RACEXTScope.h> | |
#import "TableDataViewModel.h" | |
#import "RestApiConnector.h" | |
const NSUInteger kPageSize = 30; | |
@interface TableDataViewModel () |
// | |
// View Controller | |
// | |
- (void) viewDidLoad { | |
[super viewDidLoad]; | |
RAC(self.viewModel, username) = [myTextfield rac_textSignal]; | |
RACSignal *usernameIsValidSignal = RACObserve(self.viewModel, usernameValid); |
/** | |
* Non-blocking method that immediately returns the value | |
* if available or uses a thread to fetch the value and | |
* callback via `onNext()` when done. | |
*/ | |
def Observable<T> getData(int id) { | |
if(availableInMemory) { | |
// if data available return immediately with data | |
return Observable.create({ observer -> | |
observer.onNext(valueFromMemory); |
Last week I had a crash course in PureScript - a Haskell-like language that compiles to JavaScript. I’m not about to preach that you should write your web apps in Haskell (though I strongly recommend learning Haskell), however, I do wish to explore an important part of any Functional Programming language that has eluded Javascript...
There is a lot to be said about Javascript and its lack of static typing. We’ve built the whole web with it! But this post will explore the benefits of a compile-time strong static type system.
- (void)viewDidLoad { | |
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame: CGRectZero]; | |
self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; | |
self.searchController.delegate = self; | |
// Place it in view | |
searchBar.delegate = self; | |
} | |
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)text { | |
self.searchResults = [self search: text]; |
Result of running these benchmarks on Chrome 45.0.2454.101
These numbers seem to be pretty consistent on Blink-based browsers (Chrome and Opera) but are more like 20% to 50% improvements on FireFox, Safari, and IE. I am not sure how to explain that, so take these numbers more as an indicator of “Elm is generating faster code across the board” as opposed to “Elm is 10x faster!”
extension Selector { | |
static let coffeeMadeNotification = #selector(Customer.drink(_:)) | |
} | |
class Customer { | |
@objc func drink(notification: NSNotification) { | |
print("Mmm... Coffee") | |
} | |
} |
defmodule HealthComponent do | |
use GenEvent | |
### Public API | |
def get_hp(entity) do | |
:gen_event.call(entity, HealthComponent, :get_hp) | |
end | |
def alive?(entity) do | |
:gen_event.call(entity, HealthComponent, :alive?) |