This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protocol OrderedCollection <FastEnumeration> | |
| at: UInteger index, return instancetype | |
| put: instancetype object | |
| end | |
| protocol MapCollection <FastEnumeration> | |
| at: id key, return instancetype |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <Foundation/Foundation.h> | |
| #import <ReactiveCocoa/ReactiveCocoa.h> | |
| interface Reactive | |
| property (retain) | |
| String name | |
| String address | |
| registerProperties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #undef _RACAbleObject | |
| #define _RACAbleObject(object, property) (object.rac_signalForKeyPath:@keypath(object, property), observer:self) | |
| #undef keypath1 | |
| #define keypath1(PATH) \ | |
| (((void)(NO && ((void)PATH, NO)), strchr(# PATH, *".") + 1)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Foldable | |
| -- perform a very large foldr to test tail recursion | |
| addAll :: (Foldable t, Num a) => t a -> a | |
| addAll = Data.Foldable.foldr (+) 0 | |
| n :: Integer | |
| n = 1500000 | |
| numbersList :: [Integer] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pcre *pcre_compile(const char *pattern, | |
| int options, | |
| const char **errptr, | |
| int *erroffset, | |
| const unsigned char *tableptr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Prelude | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (CONSOLE, log, logShow) | |
| import Data.Either (Either(..)) | |
| import Data.Tuple (Tuple) | |
| foreign import data PCREOption :: * | |
| foreign import data PCRECode :: * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef MainFFI_HH | |
| #define MainFFI_HH | |
| #include <pcre.h> | |
| #include "PureScript/PureScript.hh" | |
| namespace Main { | |
| using namespace PureScript; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstring> | |
| #include "Main.hh" | |
| namespace Main { | |
| static auto bitor_all( const any::array& opts ) -> int { | |
| int combined_opts = 0; | |
| for (auto it = opts.cbegin(), end = opts.cend(); it != end; it++) { | |
| combined_opts |= static_cast<int>(*it); | |
| } |
OlderNewer