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 representing an optionally nil value type. | |
protocol OptionalType: ExpressibleByNilLiteral { | |
/// The boxed optional type. | |
associatedtype Wrapped | |
} | |
extension Optional: OptionalType {} | |
// Example |
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 UIKit | |
/// Data Manager error types. | |
/// | |
/// - noData: No valid data was received. | |
/// - parsingFailure: The data parsing failed. | |
/// - endpointFailure: The endpoint failed. | |
/// - invalidInput: The input was invalid. | |
/// - anyError: Generic wrapped error. | |
enum DataError: Error { |
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
extension String { | |
func isCapitalized() -> Bool { | |
guard self.characters.count > 0 else { | |
return false | |
} | |
return (CharacterSet.uppercaseLetters as NSCharacterSet).characterIsMember(String(self.characters.first!).utf16[String.UTF16Index(0)]); | |
} | |
} | |
// Test |
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
// NSRegularExpression+Split.swift | |
// | |
// Verbatim ObjC->Swift port originating from https://github.com/bendytree/Objective-C-RegEx-Categories | |
extension NSRegularExpression { | |
func split(_ str: String) -> [String] { | |
let range = NSRange(location: 0, length: str.characters.count) | |
//get locations of matches |
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
git log --graph --pretty=format:'%Cred%h%Creset -%C(white)%d%Creset %s' | |
// Output Example: | |
* fe14be7 - (HEAD, origin/development_v1.4.0, development_v1.4.0) Updated/Cleaned/Formatted Filter Controller | |
* dd5ac6e - Updated/Cleaned/Formatted Camera Controller | |
* 5fe469f - refs #3, CC Crash on Appending nil NSString | |
* 73b7655 - refs #5, Updated Sign-out route -> /venues/VENUE_ID/checkins/SESSION_ID | |
etc... |
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
#!/bin/bash | |
# ########################################################## | |
# Author: Neil Burchfield | |
# Purpose: Pack Textures Script | |
# Date: Nov 16, 2013 | |
# ########################################################## | |
TP="/usr/local/bin/TexturePacker" |
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
#!/bin/bash | |
# ########################################################## | |
# Author: Neil Burchfield | |
# Purpose: Localization Script | |
# Date: Nov 16, 2013 | |
# ########################################################## | |
# ########################################################## | |
# Vars |
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
/** | |
* class_addIvar | |
* Adds a new instance variable to a class. | |
* | |
* BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment, const char *types) | |
* | |
* Return Value | |
* YES if the instance variable was added successfully, otherwise NO. | |
**/ |
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
/** | |
* class_respondsToSelector | |
* Returns a Boolean value that indicates whether instances of a class respond to a particular selector. | |
* Overall, class_respondsToSelector looks up the selector in the class's method table to see if it has an entry | |
* | |
* BOOL class_respondsToSelector(Class cls, SEL sel) | |
* | |
* Parameters | |
* cls | |
* The class you want to inspect. |
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
/** | |
* objc_getClassList | |
* Obtains the list of registered class definitions. | |
* | |
* int objc_getClassList(Class *buffer, int bufferLen) | |
* | |
* Parameters: | |
* | |
* buffer | |
* An array of Class values. On output, each Class value points to one class definition, up to either bufferLen or the total number of registered classes, whichever is less. You can pass NULL to obtain the total number of registered class definitions without actually retrieving any class definitions. |
NewerOlder