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
| const daggy = require('daggy') | |
| const compose = (f, g) => x => f(g(x)) | |
| const id = x => x | |
| const kleisli_comp = (f, g) => x => f(x).chain(g) | |
| //=============FREE============= | |
| const Free = daggy.taggedSum({Impure: ['x', 'f'], Pure: ['x']}) | |
| const {Impure, Pure} = Free |
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 OptionalType { | |
| typealias T | |
| var optional: T? { get } | |
| } | |
| extension Optional : OptionalType { | |
| var optional: T? { return self } | |
| } | |
| extension SequenceType where Generator.Element: OptionalType { |
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
| // these functions take a swift class's statically referenced method and the instance those methods | |
| // should apply to, and returns a function that weakly captures the instance so that you don't have | |
| // to worry about memory retain cycles if you want to directly use an instance method as a handler | |
| // for some object, like NSNotificationCenter. | |
| // | |
| // For more information, see this post: | |
| // http://www.klundberg.com/blog/capturing-objects-weakly-in-instance-method-references-in-swift/ | |
| func weakify <T: AnyObject, U>(owner: T, f: T->U->()) -> U -> () { | |
| return { [weak owner] obj in |
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
| func getQueryStringParameter(url: String, param: String) -> String? { | |
| let url = NSURLComponents(string: url)! | |
| return | |
| (url.queryItems? as [NSURLQueryItem]) | |
| .filter({ (item) in item.name == param }).first? | |
| .value() | |
| } |
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
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <!-- array of downloads. --> | |
| <key>items</key> | |
| <array> | |
| <dict> | |
| <!-- an array of assets to download --> |
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 "UITextField+RACKeyboardSupport.h" | |
| #import <ReactiveCocoa/RACEXTScope.h> | |
| #import <ReactiveCocoa/NSObject+RACDescription.h> | |
| @implementation UITextField (RACKeyboardSupport) | |
| - (RACSignal *)rac_keyboardReturnSignal { | |
| @weakify(self); | |
| return [[[[RACSignal | |
| defer:^{ |
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
| // Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
| // Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
| // Licensed under MIT (http://opensource.org/licenses/MIT) | |
| // | |
| // You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
| // PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
| #import <objc/runtime.h> | |
| #import <objc/message.h> |
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
| /** | |
| * Read text from a file at the given path | |
| * | |
| * @param {string} path given file path | |
| * @return {mixed} string with text if successful, false if error | |
| */ | |
| function readTextFromFile( path ) | |
| { | |
| var result = false; |
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
| These two files should help you to import passwords from mac OS X keychains to 1password. | |
| Assumptions: | |
| 1) You have some experience with scripting/are a power-user. These scripts worked for me | |
| but they haven't been extensively tested and if they don't work, you're on your own! | |
| Please read this whole document before starting this process. If any of it seems | |
| incomprehensible/frightening/over your head please do not use these scripts. You will | |
| probably do something Very Bad and I wouldn't want that. | |
| 2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
| versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
NewerOlder