(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // Given array of 2-tuples, return two arrays | |
| func unzip<T, U>(array: [(T, U)]) -> ([T], [U]) { | |
| var t = Array<T>() | |
| var u = Array<U>() | |
| for (a, b) in array { | |
| t.append(a) | |
| u.append(b) | |
| } | |
| return (t, u) | |
| } |
| import Foundation | |
| class Request : NSObject { | |
| var url : NSURL? = nil | |
| var request : NSMutableURLRequest? = nil | |
| var response : NSHTTPURLResponse? = nil | |
| var data: NSMutableData? = nil | |
| var done: (NSError?, NSData, NSString?) -> () = { (_, _, _) -> () in } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| public function autocomplete() { | |
| $this->request->params['named']['filter'] = $this->request->data[$this->modelClass]['filter']; | |
| if (!empty($this->request->params['named']['filter']) || $this->request->params['named']['filter'] !== '') { | |
| $this->Prg->commonProcess(); | |
| $this->Paginator->settings = array( | |
| 'conditions' => $this->Location->parseCriteria($this->Prg->parsedParams()), | |
| ); | |
| $this->set('locations', $this->Paginator->paginate()); | |
| } | |
| $this->render('autocomplete', 'ajax'); |
When buying a certificate from you CA (Certification Authority) e.g. a wildcard certificate for *.example.org, you have to convert this file to different formats in order to use them with your webserver installation.
To convert these files use OpenSSL.
Keynote I guess pushed an update that doesn't take hightlighted code from xCode anymore. So, I googled around and found highlight. It is a super useful utitlity to do syntax highlighting from the command line.
$ brew install highlight
If you are on Mavericks you may need to brew link lua to get it working right.
Hightlight has support for all kinds of languages and themes and it can wrap the code with line numbers, which is great.
| + (NSArray*)allEntriesInContext:(NSManagedObjectContext*)context fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate{ | |
| // Create the request | |
| NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Entry"]; | |
| // Build the predicate | |
| NSPredicate *predicate = [NSPredicate predicateWithFormat: @"date >= %@ && date <= %@ ", fromDate, toDate]; | |
| request.predicate = predicate; | |
| // Define sorting | |
| NSSortDescriptor *sortDesc = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES]; | |
| request.sortDescriptors = @[sortDesc]; |
| + (instancetype)sharedUtilities | |
| { | |
| __strong static id sharedUtilities; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ | |
| sharedUtilities = [[self alloc] init]; | |
| }); | |
| return sharedUtilities; | |
| } |
| ACTION | |
| AD_HOC_CODE_SIGNING_ALLOWED | |
| ALTERNATE_GROUP | |
| ALTERNATE_MODE | |
| ALTERNATE_OWNER | |
| ALWAYS_SEARCH_USER_PATHS | |
| ALWAYS_USE_SEPARATE_HEADERMAPS | |
| APPLE_INTERNAL_DEVELOPER_DIR | |
| APPLE_INTERNAL_DIR | |
| APPLE_INTERNAL_DOCUMENTATION_DIR |