This file contains 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
void CGRectDivideWithPadding(CGRect rect, CGRect *slide, CGRect *remainder, CGFloat amount, CGFloat padding, CGRectEdge edge) | |
{ | |
CGRect rect1, rect2; | |
CGRectDivide(rect, &rect1, &rect2, amount, edge); | |
if (edge == CGRectMaxXEdge || edge == CGRectMaxYEdge) | |
{ | |
CGRect tmp = rect1; | |
rect1 = rect2; | |
rect2 = tmp; |
This file contains 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
/* | |
Copyright (c) 2013 Snippex. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
This file contains 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
/* | |
Copyright (c) 2013 Snippex. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, |
This file contains 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> | |
#ifdef __SPXLOGGING | |
#define __SPXLOGGING | |
/** | |
* Custom C function for getting the current date/time. | |
* This function provides custom formatting and is much faster than using | |
* NSDate and NSDateFormatter, which a lot of log messages are sent. | |
* Also this way there's little additional memory overhead during logging. |
This file contains 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
- (instancetype)init | |
{ | |
SEL selector = @selector(initWithName:); | |
[NSException raise:NSGenericException format:@"Please use %@", NSStringFromSelector(selector)]; | |
return nil; | |
} | |
- (instancetype)initWithName:(NSString *)name | |
{ | |
self = [super init]; |
This file contains 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 | |
/** | |
* Simple GCD Wrapper | |
*/ | |
public struct Queue { | |
public typealias TimeInterval = NSTimeInterval | |
public static let Main = Queue(queue: dispatch_get_main_queue()); |
This file contains 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 enumIterator<T: Hashable>(_: T.Type) -> AnyGenerator<T> { | |
var cast: (Int -> T)! | |
switch sizeof(T) { | |
case 0: return anyGenerator(GeneratorOfOne(unsafeBitCast((), T.self))) | |
case 1: cast = { unsafeBitCast(UInt8(truncatingBitPattern: $0), T.self) } | |
case 2: cast = { unsafeBitCast(UInt16(truncatingBitPattern: $0), T.self) } | |
case 4: cast = { unsafeBitCast(UInt32(truncatingBitPattern: $0), T.self) } | |
case 8: cast = { unsafeBitCast(UInt64($0), T.self) } | |
default: fatalError("cannot be here") | |
} |
This file contains 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 UIKit | |
/// Protocol to be extended with implementations | |
protocol UIViewLoading {} | |
/// Extend UIView to declare that it includes nib loading functionality | |
extension UIView : UIViewLoading {} | |
/// Protocol implementation | |
extension UIViewLoading where Self : UIView { |
This file contains 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
/* | |
Copyright (C) 2016 Apple Inc. All Rights Reserved. | |
See LICENSE.txt for this sample’s licensing information | |
Abstract: | |
Provides a generic implementation of testing a value for value semantics. | |
*/ | |
import XCTest |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DVTConsoleDebuggerInputTextColor</key> | |
<string>0.698053 0.73105 0.720167 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>OperatorMono-Book - 13.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>0.847059 0.847059 0.376471 1</string> |