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 html> | |
<html> | |
<head></head> | |
<body> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/parse/1.2.9/parse.min.js"></script> | |
<script> | |
Parse.initialize('parse app id', 'parse app key'); | |
Parse.Cloud.run('userFriends') | |
.always(function (res) { | |
console.log(JSON.parse(res.message)); |
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
@interface FBBatchRequest : NSObject | |
#define emptyMutableArray [NSMutableArray array] | |
typedef void(^VoidCallback)(); | |
- (void) addRequest:(FBRequest*)request completionBlock:(FBRequestHandler)completionBlock; | |
- (void) startWithCompletionBlock:(VoidCallback)completionBlock; | |
- (void) start; |
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
// This goes in an NSData extension | |
convenience init (byteArray: [NSNumber]) { | |
let bytes = byteArray.combine([]) { | |
(n, inout b: [Byte], _, _) in | |
b.append(n.unsignedCharValue) | |
} | |
self.init(bytes: bytes, length: bytes.count) | |
} |
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
/// Veils a T as an NSObject. | |
public func veil <T> (value: T!) -> NSObject! { | |
if value == nil { return nil } | |
let value = value! | |
if let obj = value as? NSObject { return obj } |
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
/// Generate a unique identifier for an AnyObject. | |
/// 2nd slowest. Converts to String. | |
public func obid (object: AnyObject) -> String { | |
return "\(obid(object) as Int)" | |
} | |
/// Generate a unique identifier for an AnyObject. | |
/// Fastest. Every other function relies on this one. | |
public func obid (object: AnyObject) -> Int { |
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 QuartzCore | |
import Foundation | |
public let EaseNone = Ease(0, 0, 1, 1) | |
public let EaseOutQuad = Ease(0.25, 0.46, 0.45, 0.94) | |
public let EaseInQuad = Ease(0.55, 0.085, 0.68, 0.53) | |
public let EaseInOutQuad = Ease(0.455, 0.03, 0.515, 0.955) | |
@objc public class Ease { |
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 Nucleus | |
let display = DisplayLink() | |
public class DisplayLink { | |
private init () { | |
link = CADisplayLink(target: self, selector: "callClosures") | |
link.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) |
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 | |
public func += (set: ListenerSet, listener: Listener) { | |
set.list += listener | |
} | |
// An unordered set of Listeners. | |
public class ListenerSet { |
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
public enum ReferencePolicy { | |
case Strong, Weak | |
} | |
// Allows for a mix of strong and weak references inside Arrays and Dictionaries. | |
public class Reference <T: AnyObject> { | |
public var object: T! { | |
get { return _strong ?? _weak } |
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 EmitterKit | |
/// Forces an `object` to retain the given `value` until the `object` is deallocated. | |
/// | |
/// You must retain the returned Associated<T> object in order to keep the `value` retained by the `object`. | |
/// | |
/// Alternatively, you can call `keepAlive()` on the Associated<T> to prevent the `value` from being deallocated when the Associated<T> is released. | |
/// | |
public func associate <T> (value: T, with object: AnyObject) -> Associated<T> { |
OlderNewer